Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

So I was hoping to make a gzipped backup of my entire directory stucture, but I was very stupid and issued the command 'gzip -r ./' hoping to add all files and folders to a single gzip archive. This obviously is very wrong, but before I had time to quit, it gzipped each of my files individually (recursively) and deleted the original. Now I have a file structure that is completely made up of gzipped files. Does anyone know the command to undo what I have done (ie. extract the gzip file in place and then delete the gzip file)?

I am desperate. Thanks x1000 in advance.

Edit: Greg, you are awesome. So simple, but 'gunzip -r ./' solved it! Thank you all very much!

share|improve this question

migrated from stackoverflow.com Jun 3 '11 at 23:08

This question came from our site for professional and enthusiast programmers.

1  
this is probably close: find -type f -name '*.gz' | xargs gunzip –  Frank Farmer Jun 3 '11 at 23:02
1  
Did you try gunzip -r ./? –  Greg Hewgill Jun 3 '11 at 23:03
1  
Heh. But make sure to make a backup copy first this time. It's generally harder to undo an undo gone oops than the initial oops. –  pst Jun 3 '11 at 23:06
    
I moved my comment to an answer, since it solved your problem. –  Greg Hewgill Jun 4 '11 at 0:00
    
In the future, if you want to make a gzipped backup of your entire filesystem, use tar czf backup.tar.gz /. –  Patches Jun 4 '11 at 1:29
add comment

1 Answer

To undo this, use the opposite command:

gunzip -r ./

Note that the original gzip command will skip over files that already have a .gz suffix, because there's no point in compressing them twice. However, the above gunzip command will decompress such files, because it doesn't know that gzip skipped them.

share|improve this answer
1  
Good point - that might be an argument for using the find idea with -cmin (or -ctime if it's been days ago) as an additional qualifier so as to avoid unzipping what originally were gz files at the time of the accidental command. –  Chris Stratton Jun 4 '11 at 0:13
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.