Ugly file name

Dave Hammond daveh at marob.MASA.COM
Fri May 19 11:29:18 AEST 1989


>Several alternatives have been suggested to uniquely identify the file
>to be removed. However, there are cases in which `rm' won't do the job
>of deleting the file because the shell which is used to run `rm' may
>strip the eighth bit off characters [some shells do]. In such cases, it
>is impossible to remove the file with `rm'. You could do a clri and fsck
>but that is a little bit of overkill. A short C program will do (see my
>other posting).

I have found the `find' command quite useful in this respect.  Find's
filename expansion has no problem handling 8-bit characters, so
something like:

find . -exec rm -i {} \;

will do the trick every time.  Since find prepends "./" to each filename,
there's even no problem removing a file which accidently got named "-f".

Assuming you can latch on to some visible piece of the offending filename
(try an `ls -q'), then add a -name arg to the `find' command line and
cut down the number of "n"s you have to type while scanning for the bad
filename.

--
Dave Hammond
daveh at marob.masa.com



More information about the Comp.unix.wizards mailing list