Ugly File Name (Correction)
David C Lawrence
tale at pawl.rpi.edu
Sat May 13 16:38:44 AEST 1989
In article <3328 at orca.WV.TEK.COM> dougb at 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 at orca.WV.TEK.COM> dougb at 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 at pawl.rpi.edu" "tale at itsgw.rpi.edu" "tale at rpitsmts.bitnet"))
(error "UUCP not spoken here. Long bang paths unlikely to get mail replies.")
More information about the Comp.unix.questions
mailing list