Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I have downloaded over 7000 ebooks from Project Gutenburg, but I have an issue. Each book has been placed in its own zip file, and each zip file has been given its own folder. My problem is that I do not want to have to go through each file and unzip them and put the ebooks in one place manually. If I can get the zip files in one place, it will be an easy job to unpack all of them with one command.

So, how do I get my files into one folder, instead of in their own subfolders?

share|improve this question
add comment

3 Answers 3

Assuming that all the directories that contain the zip files have a common parent, you could use find to find all of the zip files then execute unzip on those files specifying the directory to extract the files to:

find /path/under/zip/folders -name "*.zip" -exec unzip {} -d /target/path \;
share|improve this answer
add comment

The wildcards approach can quickly get messy if there is more than a single level of nested folders...

I usually perform similar tasks (and most of other file operations) using Midnight Commander. Install it using

sudo apt-get install mc

Then just start it by typing 'mc', navigate to the folder your ebooks are in, hit Esc, then Ctrl-?, enter search criteria, in the result window hit [Panelize]. Now you can select all your zips by pressing * and copy/move them to the directory in another pane by hitting F5 or F6

share|improve this answer
add comment

Do you have experience using wildcards? you could do something like

mv common_part_of_folder_name*/*.zip .

where the asterisk symbol basically means "anything". If you only have the gutenberg in your directory, you can just run

mv ./*/*.zip .

to get all the zip files into your current directory. If it's much more complex than that, a Perl or shell script might be the way to go.

share|improve this answer
    
The OP is not trying to copy the .zip files, but trying to extract them. Therefore, the correct command would involve wildcards and an archive program. –  hexafraction Aug 3 '12 at 13:03
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.