removing files with unprintable characters in their filename
Every once in a while, either a user somehow comes up with a file with
funky characters, or I create one by accident. When displayed through a
'ls', the non-printable characters are displayed with "?"s. The "?"s are
not literal question marks, but just represent an unprintable character.
Without using shell meta characters (*), C, perl, loops, find or anything
other than just the rm command, I haven't been able to figure out how to
remove this file. There has to be a way to get rid of it with rm, but I
have had no such luck with it so far by quoting, escaping, using "--",
"./" or any other magic I can think of.
I've had the same results on woody x86, woody sparc, woody ppc, yellow
dog 2.2(ppc), redhat 7.2 x86, and solaris 8 sparc.
Some suggestions I have received so far are to delete it with rm -i *,
find -exec, by using the inode number (find --inum), or through the use of
a file browser (ick!).
These methods work, but I would really like to find the proper way to
create the string to pass rm on the command line. There has to be
some way of doing it - or are there certain filenames that cannot be
produced on the command line and/ or fed to rm?
The example below should illustrate my problem pretty well:
valites@sunfish:/tmp/file$ ls -l
total 0
-rw-r--r-- 1 valites valites 0 Sep 17 10:45 ?$??
valites@sunfish:/tmp/file$ ls -l | od -c
0000000 t o t a l 0 \n - r w - r - - r
0000020 - - 1 v a l i t e s
0000040 v a l i t e s
0000060 0 S e p 1 7 1 0 : 4 5
0000100 214 $ 255 373 \n
0000105
valites@sunfish:/tmp/file$ ls -b
\214$\255\373
valites@sunfish:/tmp/file$ rm -i * #<- don't want to
use this...
rm: remove `\214$\255\373'? n
valites@sunfish:/tmp/file$ rm \214$\255\373
rm: cannot remove `214$255373': No such file or directory
valites@sunfish:/tmp/file$ rm \214\$\255\373
rm: cannot remove `214$255373': No such file or directory
valites@sunfish:/tmp/file$ rm '\214$\255\373'
rm: cannot remove `\\214$\\255\\373': No such file or directory
valites@sunfish:/tmp/file$ rm '\214\$\255\373'
rm: cannot remove `\\214\\$\\255\\373': No such file or directory
valites@sunfish:/tmp/file$ rm "\214$\255\373"
rm: cannot remove `\\214$\\255\\373': No such file or directory
valites@sunfish:/tmp/file$ rm "\214\$\255\373"
rm: cannot remove `\\214$\\255\\373': No such file or directory
valites@sunfish:/tmp/file$ rm ./\214\$\255\373
rm: cannot remove `./214$255373': No such file or directory
valites@sunfish:/tmp/file$
Any help is appreciated ahead of time!
-Mark
>--))> >--))>
Mark T. Valites
Unix Systems Analyst
1 College Circle - 124b1 South Hall
SUNY Geneseo
Geneseo, NY 14454
585-245-5577
585-259-3471 (Cell)
585-245-5579 (Fax)
Reply to: