Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!csd4.milw.wisc.edu!leah!rpi!rpi.edu!tale From: tale@pawl.rpi.edu (David C Lawrence) Newsgroups: comp.unix.questions Subject: Re: Ugly File Name (Correction) Message-ID: Date: 13 May 89 06:38:44 GMT References: <3328@orca.WV.TEK.COM> <3330@orca.WV.TEK.COM> Sender: usenet@rpi.edu Reply-To: tale@pawl.rpi.edu Distribution: usa Lines: 48 In-reply-to: dougb@mustang.WV.TEK.COM's message of 13 May 89 00:39:03 GMT In article <3328@orca.WV.TEK.COM> dougb@orca.WV.TEK.COM (Doug Becker) wrote: > One way to remove [a file with offending characters] is to move > everything out of the directory except [that] file, then rm -rf > the directory containing [it] (and then restore [the directory]). In <3330@orca.WV.TEK.COM> dougb@mustang.WV.TEK.COM (Doug Becker) writes: > I of course meant 'rmdir -rf,' not 'rm -rf'. Sorry if this caused > any confusion. My mailer won't let me cancel the article, and this is my > first posting error. (Honest! :-) ) Of course. For some weird variant of Unix that somehow managed to munge a basic utility like rm/rmdir. Your correction to your original suggestion is worse than the original because the second wouldn't even work on most Unix systems. This is one of the frequently asked questions that comes up from time to time. Everything from suggesting "ls -i followed by find . -inum whatever-ls-said-the-inum-was -exec rm {} \;" to the above suggestion of recursively removing the directory once the offending file(s) is all that remains in it. Perhaps the best way to do it as a general case is with a) shell wildcard characters or b) the shell quoting convention. Take the file "Bogus\014file\001" in the current directory. The file can be dealt with by: % rm Bogus^V^Nfile^V^A # C-v usually quotes the next character % rm Bogus?file? # provide the pattern matches only that expr Files with spaces? % mv 'file with spaces' bettername I can't guarantee that this works on everything because I haven't tried it on everything, but any file I've had so far on either SysV or BSD systems have fallen to quoting or wildcards. Oh, regarding rmdir -rf: rmdir takes a directory name as an argument; there are no options. rm (in its standard incarnation) takes r, i and/or f as options for recursive unlinking, interactive prompting, and ignorance of file permissions and/or success of the unlink. Dave -- (setq mail '("tale@pawl.rpi.edu" "tale@itsgw.rpi.edu" "tale@rpitsmts.bitnet")) (error "UUCP not spoken here. Long bang paths unlikely to get mail replies.")