Find the answer to your Linux question:
Results 1 to 7 of 7
I've checked out the man pages for unzip, and it doesn't seem to have a recursion flag, to unzip all the files in a directory and subdirectories tree. How do ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    mwt
    mwt is offline
    Just Joined!
    Join Date
    Feb 2006
    Posts
    2

    Unzip Commands


    I've checked out the man pages for unzip, and it doesn't seem to have a recursion flag, to unzip all the files in a directory and subdirectories tree. How do people normally unzip all the zip files located in a large set of subdirectories?

  2. #2
    Linux Enthusiast deltaflyer's Avatar
    Join Date
    May 2005
    Posts
    577
    depending on which distro/ de you use, you could use ark,fileroller et al

    andy
    SLOMO: acer extensa 5235 2.2ghz,2gb ram 160gb hdd wireless
    SPEEDY: homebrew desktop,Amd x2 dualcore,2gb ram,500gb +1tb( 2x500gb) hdd suse 11.3,32mb fibreline
    registered linux user #401845

  3. #3
    Linux Enthusiast
    Join Date
    Aug 2005
    Location
    Hell
    Posts
    514
    Quote Originally Posted by mwt
    I've checked out the man pages for unzip, and it doesn't seem to have a recursion flag, to unzip all the files in a directory and subdirectories tree. How do people normally unzip all the zip files located in a large set of subdirectories?
    how about something like this?
    Code:
    find . -name "*.zip" -exec unzip '{}' \;

  4. #4
    mwt
    mwt is offline
    Just Joined!
    Join Date
    Feb 2006
    Posts
    2
    Quote Originally Posted by spoon!
    how about something like this?
    Code:
    find . -name "*.zip" -exec unzip '{}' \;
    That works almost perfectly, except that all the unzipped files are moved to the current working directory (the default behavior of unzip). I want them to stay in their individual directories, which I assume means using the -d flag. I just don't know how to code that. Help?

  5. #5
    Banned
    Join Date
    Aug 2004
    Posts
    15
    I just checked my man page
    unzip extracts all files by default

  6. #6
    Linux User muha's Avatar
    Join Date
    Jan 2006
    Posts
    290
    Unzip multiple zip-files and recurse to lower directories. Extract each zip to the directory it is in.
    Code:
    for i in `find . -name "*.zip"`; do unzip -d `dirname $i` $i;done;

  7. #7
    Just Joined! devnulljp's Avatar
    Join Date
    Mar 2009
    Posts
    3
    Escape the * character:

    unzip \*.zip

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •