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

Jeff Vian jvian10 at charter.net
Mon Feb 14 10:33:38 UTC 2005


On Sun, 2005-01-30 at 14:04 -0200, Leandro Melo wrote:
> Hi.
> I had a zip file which i needed to extract. 
> This zip file contains a base folder in which there are a few subfolders, etc...
> I opened the zip file with file roller, which naturally showed me the
> base folder (the one i just mentioned). Then I set it to extract this
> file under /usr/.
> Specifically, this was the Eclipse project file. The zip file contains
> a base folder called eclipse in which are all the subfolders and
> project files.
> Then i thought that file roller would extract the files to me in a way
> that i would maitain the same hierarchy. So, i thought i would have
> the folder /usr/eclipse and under /usr/eclipse i would have the other
> subfolders and files.
> The problem is that when i told it to extract, file roller simply
> extract all FILES of the original zip file undre /usr/. So now i got
> hundreds of file under my /usr/ directory.
> Addionally, file roller didn't create any of the subfolders of the
> eclipse base folder (which, as said, was not created either).
> What could i do to "undo" this process? I'm very new to linux.
> Is there a way i to delete files created at some specific date??? So i
> just would go with this. For example: Delete all files created after
> saturday 30.
> 
> Also, i could delete only all FILES from my /usr/ dir, which before
> the whole thing only had subfolders. Maybe i could use rm for that,
> but as i'm a linux beginner i'm not sure which comannda line options
> to use. Maybe: rm -/usr/*
> 
> Well, any help is appreciated.
> 
> 
> 
A simple script to do it may be:
This does a listing of the contents of the directory, and if it is a
regular file it will delete it.  It thus ignores subdirectories and
their contents.  This can also be entered in this way at the command
line with the same effect. You may want to add the -f option to the rm
command since by default root has rm aliased to "rm -i".

for i in `ls /usr`
do
if [ -f /usr/$i ] ; then
   rm /usr/$i
fi
done



For future use of file roller, there is a check box on the extract
screen that sets the option to recreate folders.

> -- 
> Leandro
> 




More information about the fedora-list mailing list