Blogs Jelle's blog Unzipping lots of files in subdirectories to the current directory
There are no translations available.

Have you ever had a bunch of subdirectories each filled with only one zip file? Or have you ever had a task that needed to be done in the same way?
Well here's a handy little line of code that will help you on your way!

find -name '*.zip' | xargs -n1 echo unzip

This doesn't actually do anything yet, it searches for .zip files in every subdirectory relative to the one you're currently in and then echoes what it'll do to those files once you remove the `echo` command
So actually typing:

find -name '*.zip' | xargs -n1 unzip

Will perform the command. Another example, if you want to copy lots of files from the subdirectory of one map to another, you can do this:

find /home/user/map/ -name "*.txt" | xargs -i cp -v {} .

This will copy every .txt file under any directory, starting from /home/user/map/, to your current directory. (No matter where you are)

I love it, and it has saved me lots of time!


Jelle De Loecker
Written on Saturday, 17 July 2010 23:04 by Jelle De Loecker

Viewed 4720 times so far.
Like this? Tweet it to your followers!

Latest articles from Jelle De Loecker

Latest 'tweets' from Jelle De Loecker

  • Vandaag heeft mijn vakantiebudget zich ook getransformeerd naar een kledingsbudget. 3 jeans, 1 paar flashy schoenen en een t-shirt. #fb Link Saturday, 19 May 2012 13:58
  • Net TWEE UUR de auto staan wassen. This is what you get for buying a white car! #fb Link Saturday, 19 May 2012 13:52
  • I unlocked the Marvel’s The Avengers Box Office sticker on @GetGlue! http://t.co/t4A8ryM3 Link Thursday, 17 May 2012 14:39
blog comments powered by Disqus

Watch our shortmovie "Zin"

Scroll To Top