Big mistaking extracting files, how to "undo" it?

Matthew Saltzman mjs at ces.clemson.edu
Sun Jan 30 22:20:21 UTC 2005


On Sun, 30 Jan 2005, James McKenzie wrote:

> Matthew Saltzman wrote:
>> On Sun, 30 Jan 2005, Leandro Melo wrote:

>> "rm /usr/*" will delete only files in the directory /usr.  Directories will 
>> remain intact.  To recursively delete directories and their contents, use 
>> "rm -r <path>".  If you are getting prompts for every file, use "\rm 
>> /usr/*".  Read "man rm" carefully.
>> 
>> FYI, here's the contents of my /usr/ dir:
>> 
>> $ ls /usr
>> bin  etc    include  kerberos  libexec  lost+found  share  tmp
>> doc  games  java     lib       local    sbin        src    X11R6
>> 
> If you were do delete the /usr directory, you will end up reinstalling Linux.

Why?  There are usually no regular files in /usr (and the OP knew he had 
none).  "rm *" removes only regular files in the current directory.  It 
doesn't delete or descend directories.  Deleting directories requires "rm 
-r".  (Sure, you do have to be careful, but if you don't do it wrong, you 
won't be screwed.)

If you are nervous, you could "rm *.*".  That would probably get most 
files and no directories (as none have extensions).  Then clean up the 
rest by hand.

> I recommend the following:
>
> unzip -t <insert zip file name here> > filelist.txt
>
> list out filelist.txt to a printer.
>
> You can then use this file as input to a script file which can then step 
> through the file and rm (remove) the files that were extracted in the /usr 
> directory by accident

This will work, but it seems overly paranoid in this case.

-- 
 		Matthew Saltzman

Clemson University Math Sciences
mjs AT clemson DOT edu
http://www.math.clemson.edu/~mjs




More information about the users mailing list