Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!watmath!clyde!akgua!sdcsvax!sdcrdcf!hplabs!sri-unix!cepu!scw@UCLA-LOCUS.ARPA From: scw@UCLA-LOCUS.ARPA Newsgroups: net.unix-wizards Subject: Re: deleting a bad directory Message-ID: <638@sri-arpa.UUCP> Date: Thu, 10-May-84 16:29:00 EDT Article-I.D.: sri-arpa.638 Posted: Thu May 10 16:29:00 1984 Date-Received: Mon, 14-May-84 00:19:56 EDT Lines: 59 From: Steve Woods >I took over this host in March and have been trying to get rid of a bad >directory which was created in November. The directory cat/file string >is '/u17/lost+found/#005628'. I position myself at the directory >'lost+found' and then enter "rm -rf *562*" just encase there are any >unprintable characters. The response is 'rmdir: Cannot remove "#005628". >No such file or directory.' Do you have any suggestions on how to clean >this out. Thanks: >Herb Overstreet (DCA-EUR Administrator) Try the following: (1) od -c . >foo.c (2) edit foo.c, find the line with the correct entry conviently (under v7 anyway) each directory in the directory takes exactly one line in the od -c output. delete all other lines: delete the first 3 fields (offset and the inode number), delete spaces between characters (there are 3 between valid letters, and 1 between letters that are < ' ' or > 0176 and not in the standard [\f, \r, \b, \n, \0] set of escapable and 2 between escapable characters. much like below: {typical od -c of a V7 directory} offset |inode #| file name-------------------------------------------- 0000000 002 \0 . \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 0000020 002 \0 . . \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 0000040 253 \0 u u r u n \0 \0 \0 \0 \0 \0 \0 \0 \0 . . . 0001020 377 004 # 0 0 5 6 2 8 177 \0 \0 \0 \0 \0 \0 . . . Turn the line of interest into a quoted string. "#005628\177\0\0\0\0\0\0" Then build a c program around the string: #include char *oldname="#005628\177\0\0\0\0\0\0"; main() { if(link(oldname,"foobar") != -1)unlink(oldname); else printf("link failed\n"); } (3) Compile and execute foo.c (cc foo.c;a.out;) (4) the old garbage name has been replaced with foobar. The file may then delt with as desired. NOTES: if the old file is a directory you must be the SUPERUSER to link to it. You MUST have Write permission on the target directory (to create the link and to unlink the old file). --------------------------------------------------------------------------------