A File Exercise - (nf)
acheng at uiucdcs.UUCP
acheng at uiucdcs.UUCP
Fri Aug 3 19:54:00 AEST 1984
#R:wdl1:17100004:uiucdcs:13700056:000:1448
uiucdcs!acheng Aug 3 04:54:00 1984
>... Another *really*
>fun experience that I had with file names came as a result of some
>(heretofore forgotten) program barfing and creating a file with
>*control* characters as part of the file name -- it wouldn't have been
>*too* bad if I could have used rm -i and matched a printable
>character, but *none* were printable and I was running on a system
>without -i.... Any guesses as to how I rm'ed it? No, I didn't rm *.
One may cp all the good files away, "rm -r troubledir" and then
reconstruct the directory. But if there are sub-dirs, it takes more effort.
I once was in a system that could not "mv dir newdir" and i solved that by:
1) cd troubledir
2) tar cf /tmp/TMP.tar .
3) cd ..;rm -r troubledir;mkdir troubledir;cd troubledir
[strange result may happen if one tries "rm -r ." ]
4) tar tf /tmp/TMP.tar > /tmp/list
5) "edit /tmp/list" to delete those bad names;
[if there is sub-dir in troubledir, retain only sub-dir names]
6) tar xfp /tmp/TMP.tar `cat /tmp/list`
[the "p" option restores ownership, modes,... I forgot if
i had it then.]
Also, one may write a program (isn't that what we are born for?) to read
the directory. Then you may choose to unlink the file or change
the name
ln(old, new); unlink(old);
I met a terminal case--somehow the directory got trashed and the
content was changed from "foobar" to "foo\0ar". rm -r couldnot
delete it. I resorted to "clri" and "icheck -s" (no fsck in that
system.)
More information about the Comp.unix.wizards
mailing list