* Deleting files with odd names
@ 1995-10-03 4:00 Dave Hodgson
1995-10-05 4:00 ` John van der Voort van der Kleij
` (4 more replies)
0 siblings, 5 replies; 7+ messages in thread
From: Dave Hodgson @ 1995-10-03 4:00 UTC (permalink / raw)
I have a bunch of files in a directory which were tranferred from a Macintosh.
Somehow the files whose names contained slashes '/' transferred OK and they
appear, when using `ls`, as having a name with a slash in, e.g:
% ls
name/with/slash/in/it
% ls -al
name/with/slash/in/it not found
total 6
drwxrwxr-x 14 marvin 4096 Oct 3 15:49 .
drwxrwsr-x133 marvin 24576 Oct 3 16:13 ..
The name is obviously incompatible with UNIX that uses a '/' to delimit
directory names in a path.
But no matter how I try I can't delete that damn things, even when I try
`rm -rf` on the directory above...
Please mail me if you have a solution....
Cheers,
Dave
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Deleting files with odd names
1995-10-03 4:00 Deleting files with odd names Dave Hodgson
1995-10-05 4:00 ` John van der Voort van der Kleij
@ 1995-10-05 4:00 ` Joseph B. Gurman
1995-10-11 4:00 ` Michael Sternberg
1995-10-06 4:00 ` Dave Hodgson
` (2 subsequent siblings)
4 siblings, 1 reply; 7+ messages in thread
From: Joseph B. Gurman @ 1995-10-05 4:00 UTC (permalink / raw)
In article <44rk7q$bg2@lyra.csx.cam.ac.uk>, Dave Hodgson
<dmh@sanger.ac.uk> wrote:
> I have a bunch of files in a directory which were tranferred from a Macintosh.
>
> Somehow the files whose names contained slashes '/' transferred OK and they
> appear, when using `ls`, as having a name with a slash in, e.g:
>
> % ls
> name/with/slash/in/it
> % ls -al
> name/with/slash/in/it not found
> total 6
> drwxrwxr-x 14 marvin 4096 Oct 3 15:49 .
> drwxrwsr-x133 marvin 24576 Oct 3 16:13 ..
>
> The name is obviously incompatible with UNIX that uses a '/' to delimit
> directory names in a path.
>
> But no matter how I try I can't delete that damn things, even when I try
> `rm -rf` on the directory above...
Dave -
I guess people just aren't being brainwashed with first-grade Bourne
any more (and probably a good thing).
If you want to "quote" an escape character (.i.e., one the shell would
rather do something else with), precede it with a knockdown (backslash: \)
character: e.g.
% rm name\/with\/slash\/in\/it
This even works for spaces (another MacPossibility).
rm -rf doesn't work because (of course, you say, regaining your unix
tunnel vision) it assumes an argument of all _regular_ expressions in the
pwd.
I could refer you to a great chapter in the Unix Hater's Handbook on
how braindead unix file name parsing is, but what's the point?
Hope this helps,
Joe Gurman
--
Joseph B. Gurman / NASA Goddard Space Flight Center/ Solar Data Analysis Center / Code 682 / Greenbelt MD 20771 USA / gurman@uvsp.nascom.nasa.gov
| Federal employees are still prohibited from holding opinions while at work. Any opinions expressed herein must therefore be someone else's. |
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Deleting files with odd names
1995-10-03 4:00 Deleting files with odd names Dave Hodgson
@ 1995-10-05 4:00 ` John van der Voort van der Kleij
1995-10-05 4:00 ` Joseph B. Gurman
` (3 subsequent siblings)
4 siblings, 0 replies; 7+ messages in thread
From: John van der Voort van der Kleij @ 1995-10-05 4:00 UTC (permalink / raw)
To: dmh
Hi Dave,
Try putting double quotes around the original name. I had a problem
like you with temporary filenames as "#filename#". The trick with the quotes
worked in my case.
John.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Deleting files with odd names
1995-10-03 4:00 Deleting files with odd names Dave Hodgson
1995-10-05 4:00 ` John van der Voort van der Kleij
1995-10-05 4:00 ` Joseph B. Gurman
@ 1995-10-06 4:00 ` Dave Hodgson
1995-10-07 4:00 ` Thomas Leitner
1995-10-11 4:00 ` Daniel S. Riley
4 siblings, 0 replies; 7+ messages in thread
From: Dave Hodgson @ 1995-10-06 4:00 UTC (permalink / raw)
*sigh*
Of _course_ I tried '\' to escape the '/' characters!
And of course I tried wrapping quotes around the thing!
I have now fixed the problem, here's the answer that came from Burkhard
Neidecker-Lutz at Digital:
This is a known bug with old versions of MacIntosh NFS. The catch here is
that there is *NO* way to delete that file via name from UNIX, because
the kernel "nametoi" function cannot get past the "/" characters. They
can be introduced only via NFS (which doesn't use the nametoi function
but rather constructs pathes one by one).
Solution 1:
Delete from the Mac. It created the invalid thing in the
first place and can work around the problem.
Solution 2:
ls -i
4711 name/with/slash/in/it
(the actual number will not be 4711). Unmount the file system. Now (assuming
here that the file systen is a UFS file system on disk /dev/rrz3g):
fsdb -w /dev/rrz3g
> 4711:inode
> :ln=0
> :quit
This will set the link count of the file to zero. Now force a file system
check on that file system:
fsck -o /dev/rrz3g
and answer "yes" when fsck offers to remove the file in question.
Many thanks to all those that mailed,
Dave
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Deleting files with odd names
1995-10-03 4:00 Deleting files with odd names Dave Hodgson
` (2 preceding siblings ...)
1995-10-06 4:00 ` Dave Hodgson
@ 1995-10-07 4:00 ` Thomas Leitner
1995-10-11 4:00 ` Daniel S. Riley
4 siblings, 0 replies; 7+ messages in thread
From: Thomas Leitner @ 1995-10-07 4:00 UTC (permalink / raw)
Dave Hodgson (dmh@sanger.ac.uk) wrote:
> I have a bunch of files in a directory which were tranferred from a Macintosh.
>
> Somehow the files whose names contained slashes '/' transferred OK and they
> appear, when using `ls`, as having a name with a slash in, e.g:
>
> % ls
> name/with/slash/in/it
[...]
I always use "rm -i *" and answer "y" for the file I want to delete.
Of course this isn't so easy if you got lots of other files in the same
directory.
Tom
--
Tom Leitner, tom@finwds01.tu-graz.ac.at |\ _,,,---,,_
Dept. of Communications zzz. /,`.-'`' -. ;-;;,_.
Graz University of Technology |,4- ) )-,_. ,\ ( `'-'
Inffeldgasse 12 '---''(_/--' `-'\_)
A-8010 Graz / Austria / Europe, Phone: +43-316-873-7455, Fax: +43-316-463-697
WWW home page: http://wiis.tu-graz.ac.at/people/tom.html
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Deleting files with odd names
1995-10-05 4:00 ` Joseph B. Gurman
@ 1995-10-11 4:00 ` Michael Sternberg
0 siblings, 0 replies; 7+ messages in thread
From: Michael Sternberg @ 1995-10-11 4:00 UTC (permalink / raw)
gurman@uvsp.gsfc.nasa.gov (Joseph B. Gurman) writes:
>In Dave Hodgson <dmh@sanger.ac.uk> wrote:
>> I have a bunch of files in a directory which were tranferred from a
>> Macintosh.
>>
>> Somehow the files whose names contained slashes '/' transferred OK and they
>> appear, when using `ls`, as having a name with a slash in
THE classical mischief when Macs are allowed to talk to Unices with a
gullible NFS interface.
>> But no matter how I try I can't delete that damn things, even when I try
>> `rm -rf` on the directory above...
> I guess people just aren't being brainwashed with first-grade Bourne
>any more (and probably a good thing).
This surely would be a great idea. If only it were thorough enough <evil
grin>.
>% rm name\/with\/slash\/in\/it
As far as the 'rm' is concerned, this is a nop. The backslashes
protect special characters from the _shell_. Now, '/' is not so much
special, so that it doesn't even need to be protected. So, as the
shell is concerned, it is a nop, too.
Dave,
Get the Mac-user to delete the d*mn thing.
If this is not an option, note that the file name only appears in its
directory "." . IF you can edit this dirfile on a low level, just
change the "/" to something useful. For such rare cases I use "fm".
You might need to do this on the raw device. Needless to say -
be _very_ cautious. umount, edit, then fsck, mount, rm -f -- done
Check for an NFS-patch for your system.
Greetings,
--
Michael Sternberg, Physics Research Scholar mgs@po.cwru.edu
Case Western Reserve University Lab phone: (216) 368 4034
"Who disturrrbs me at this time?" << Zaphod Beeblebrox IV >>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Deleting files with odd names
1995-10-03 4:00 Deleting files with odd names Dave Hodgson
` (3 preceding siblings ...)
1995-10-07 4:00 ` Thomas Leitner
@ 1995-10-11 4:00 ` Daniel S. Riley
4 siblings, 0 replies; 7+ messages in thread
From: Daniel S. Riley @ 1995-10-11 4:00 UTC (permalink / raw)
In article <455plm$uva@fstgal00.tu-graz.ac.at>
tom@finwds01.tu-graz.ac.at (Thomas Leitner) writes:
tom> I always use "rm -i *" and answer "y" for the file I want to delete.
tom> Of course this isn't so easy if you got lots of other files in the same
tom> directory.
And you need to make sure you don't have a file named '-f'. 'rm -i ./*'
is safer.
--
Dan Riley Internet: dsr@lns598.lns.cornell.edu
Wilson Lab, Cornell University HEPNET/SPAN: lns598::dsr (44630::dsr)
"Distance means nothing/To me." -Kate Bush
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~1995-10-11 4:00 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
1995-10-03 4:00 Deleting files with odd names Dave Hodgson
1995-10-05 4:00 ` John van der Voort van der Kleij
1995-10-05 4:00 ` Joseph B. Gurman
1995-10-11 4:00 ` Michael Sternberg
1995-10-06 4:00 ` Dave Hodgson
1995-10-07 4:00 ` Thomas Leitner
1995-10-11 4:00 ` Daniel S. Riley
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox