Oops - how to undo gzip of entire web directory? [closed]

So.. yeah. I don't spend a lot of time on the linux command line and instead of making a zip file of the web directory, I gzipped everything in the web directory. What's the anecdote to stupidly doing this from the web root?

sudo gunzip ../_downloads/ecpt ./*

I really need to undo this asap..


If you're sure everything in the web directory should be unzipped (e.g. nothing was zipped prior), you can use the 'find' utility like so:

find /web/root -type f -iname "*.gz" -exec gunzip {} \;

that will find:

  • all files (-type f)
  • in the web root (/web/root in the example)
  • with an extension of .gz (-iname "*.gz" which does case-insensitive search)

and executes the gunzip program on that file (the {} curly brackets are replaced by the file names that find matches). The backslash-escaped semicolon is required on the end in order to terminate the -exec statement.

There's other ways to do it using other command-line utilities or scripting languages - I tend to use find a lot so this one was easiest for me to describe.

Hope that helps!