Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Posting-Version: $Revision: 1.6.2.14 $; site uiucdcs.UUCP
Path: utzoo!watmath!clyde!burl!ulysses!mhuxl!ihnp4!inuxc!pur-ee!uiucdcs!acheng
From: acheng@uiucdcs.UUCP
Newsgroups: net.unix-wizards
Subject: Re: A File Exercise - (nf)
Message-ID: <13700056@uiucdcs.UUCP>
Date: Fri, 3-Aug-84 05:54:00 EDT
Article-I.D.: uiucdcs.13700056
Posted: Fri Aug  3 05:54:00 1984
Date-Received: Sat, 4-Aug-84 23:48:38 EDT
References: <17100004@wdl1.UUCP>
Lines: 36
Nf-ID: #R:wdl1:17100004:uiucdcs:13700056:000:1448
Nf-From: uiucdcs!acheng    Aug  3 04:54:00 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.)