Jump to content

Help Need An Archive Manager Or Cli Unzipper


PastEgo

Recommended Posts

i have about 6000 zip files i need to unzip but must

ignore any paths stored in the archive and unzip into the current directory

ignore any errors in the zip file and skip it

i could do this in winrar but file roller which comes with ubuntu is no good and the unzip command does not seem powerful enough - please correct me if i am wrong

anyone have any suggestions

many thanks

PastEgo

Link to comment
Share on other sites

You're looking for the 'unzip' command. The "-j" option will move all the files into the root directory.

I'd suggest doing a

 unzip -j *.zip ~/Desktop/zip

Note that I can't see a way to avoid it choking on errors, but it will tell you the problems and you can remove the offending files.

Link to comment
Share on other sites

great the problem is that a large number of files have nested sub directories within which i dont want i just want the file itself that is stored in there

will the -j do that

thanks again

PastEgo

Link to comment
Share on other sites

great the problem is that a large number of files have nested sub directories within which i dont want i just want the file itself that is stored in there

will the -j do that

thanks again

PastEgo

from the unzip manual page

		[-x xfile(s)]
		   An  optional  list of archive members to be excluded from processing.  Since wildcard charac‐
		   ters normally match ('/') directory separators (for exceptions see the option -W, this option
		   may be used to exclude any files that are in subdirectories.  For example, ''unzip foo *.[ch]
		   -x */*'' would extract all C source files in the main directory, but none in any  subdirecto‐
		   ries.   Without the -x option, all C source files in all directories within the zipfile would
		   be extracted.

so I would expect that

 unzip filename.zip -x */*

would do the trick.

If your zip files are in multiple directories as well you could say

 find . -type f -name \*.zip -print -exec unzip {} -x "*/*" \;

to find all .zip files starting from current directory and unzip all of them to the current directory. Only files in the root directory inside of the zip files will be extracted.

HTH :)

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.



×
×
  • Create New...