Path: utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!tut.cis.ohio-state.edu!ucbvax!decwrl!shelby!csli!gandalf From: gandalf@csli.Stanford.EDU (Juergen Wagner) Newsgroups: comp.unix.xenix,comp.unix.questions,comp.unix.wizards Subject: Re: Ugly file name Keywords: rm cat mv regexp Message-ID: <9000@csli.Stanford.EDU> Date: 16 May 89 20:57:09 GMT References: <128@tdl.UUCP> <7170@bsu-cs.bsu.edu> <1614@auspex.auspex.com> <448@hsi86.hsi.UUCP> Sender: gandalf@csli.Stanford.EDU (Juergen Wagner) Reply-To: gandalf@csli.stanford.edu (Juergen Wagner) Followup-To: comp.unix.xenix Distribution: usa Organization: Center for the Study of Language and Information, Stanford U. Lines: 49 Xref: utzoo comp.unix.xenix:6022 comp.unix.questions:13655 comp.unix.wizards:16170 Sigh! There we go again... You can delete files with the `rm' command, or with the following C program: # define FILE "..." /* name of file to remove */ main() { if (unlink(FILE) < 0) perror("unlink"); exit(0); } Let's call this program "do-rm". Ok, now here are the cases: [1] Files with ASCII characters (20h..7eh) in their names: Cd to the directory containing the file to be removed. Execute /bin/rm './FILE' where FILE is the name of your file. If your file name contains single quotes, you have to use a more tricky quoting scheme, e.g. /bin/rm './-foo'"'"' bar'"'" will remove the file named -foo' bar' from your currect directory. Don't forget to put backslashes in front of '!'s (if you're in csh). [2] Files with characters in the range 01h..1fh, 7fh in their names: The same method as under [1] is applicable, but now the non-printing characters have to be included in the file name. Non-printing characters can be typed by using ^V to prevent interpretation. (^V is the lnext character, it can be set with stty). Note that newline characters (0ah) have to be preceded with a '\'. [3] Files with characters in the range 80h..ffh in their names: Most shells don't like the idea of having 8-bit characters, i.e. shell commands won't work, even if you manage to get the correct characters into the argument. In such cases, the above C program can be used (short of clri and fsck). I hope that helps to clarify the situation. If you [the reader] have any comments on this posting, please reply to me. DON'T POST YOUR REPLIES. -- Juergen Wagner gandalf@csli.stanford.edu wagner@arisia.xerox.com