Batch recompress zip archives?

krs000a

Honorable
Mar 29, 2013
13
0
10,560
I am looking for a software that can batch recompress alot of zip archives. Just to clarify what I mean with this:
I have alot (30.000+) smaller zip archives. Many of them are zipped with different programs, using different parameters, compression levels, etc. I want the software to UNZIP all of them, and REZIP them all to new, fresh archives, so that they all become identically zipped, use the same type of compression etc.
OR, alternatively, I suppose I could have a program that batch unzip each archive to individual folders (this can easily be done), but then I would need a program that can batch-zip each folder's CONTENT (not the folder itself, only the files within the folder) into a new zip file, named according to the name of folder that the files are in. Sorry if this sounds confusing. I hope someone will understand what I want to accomplish.
Any suggestions welcomed!
 
You can use the command line options for any of the compression programs but you need to do a script with the logic for what you want to do.
Read in all of your folder names, go through them and plug in the variable name for the folder/file to the script that uncompresses them. When that is done, use the reverse and compress them.

Will look something like

For each file in C
Do
winzip /sampleswitch %file% /uncompressed default folder

So read in each file, use that name to run the command to un-compress it. Then basically same command but with the compression option set.
 
By saying "been compressed using different programs" - does this mean also RAR, 7ZIP, ARC, GZ formats?
You will have bigger troubles fetching these 30,000 zip files (don't tell me you keep them all in a single folder).

But the question - why? If you are able to work with these archives using single (WinZip) program, re-compressing them will gain you only a single percentage in disk space.
 

krs000a

Honorable
Mar 29, 2013
13
0
10,560
They are all ZIP archives, but not all were compressed with WinRAR and some with different compression levels. I won't gain any disc space, at least not to the point where it will make a difference, I just like consistency. Please just tell me if it's possible and how
 

krs000a

Honorable
Mar 29, 2013
13
0
10,560
I'm sorry I don't understand how. :( I don't know how to use scripts.



 

You're looking for very custom task, and you are about to make it by yourselves.

- Google/Bing/Yahoo/Yandex your way to "windows batch scripting"
- Write a script which traverses all subfolders of a folder where your old ZIPs are staying
- Make this script call another script which processes your files one by one. Place a mark in that folder that it is processed
You will also need command-line version of your compressing utility of choice

Start first with writing a script which recompresses: Extract to a temporary folder, recompress, delete temp folder
Then, master enumerating all files from a folder, and calling your already-proven-to-work recompress script. Then finish with processing a directory tree.

It's without saying that you don't want to try all this on your only copy of data.
 


Good time to learn then, unless you know someone that can write it for you.