Weird File Names (Removing them)

Jean-Pierre Radley jpr at dasys1.UUCP
Mon Feb 27 16:30:56 AEST 1989


In article <91 at raider.MFEE.TN.US> root at raider.MFEE.TN.US (Bob Reineri) writes:
>One of them has a file in his home directory that I can't get rid of to save
>my life. In a regular 'l' listing, it has a filename of the greek letter
>Sigma. Doing an l with the -b option reveals a value of '/744'. Anyone can
>give me a way to delete this annoying little file ? Thanks.
>
>rm refuses to recognize it, even if I just try to delete all files
>interactively. That is, 'rm -i *' skips over it. 

This question comes up every other month. When you start getting other
than plain printable ASCII characters in a file name, or if you get a file
name that starts with '-', you won't be able to enter a keyboard command
too readily that will work for 'rm'. The expansion of '*' may not,
depending on what version of which shell you're using, cover 8-bit
characters; in any case, it won't encompass filenames starting with '.'.

First, 'cd' to the directory-with-the-problem. Then type 'ls -i' to obtain
the inode number, say NNN, of the weird filename.
Then, use the '-inum' option of find (it seems to be present in all versions
of find, but SCO seems to have dropped any reference to -inum in the manual
page for find):

  find . -inum NNN -exec rm {} \;

Perhaps you first want to see if the file is of interest, and find that you
can't feed its name to 'cat' any more than you could feed it to 'rm'. Then:
  
  find . -inum NNN -exec mv {} newname \;
-- 
Jean-Pierre Radley		Honi soit		jpr at dasys1.UUCP
New York, New York		qui mal			...!hombre!jpradley!jpr
CIS: 76120,1341			y pense			...!hombre!trigere!jpr



More information about the Comp.unix.xenix mailing list