Solved

batch file for multiple zipped files

Posted on 2011-03-25
7
569 Views
Last Modified: 2012-05-11
I have just looked at this post

http://www.experts-exchange.com/OS/Microsoft_Operating_Systems/MS_DOS/Q_26673600.html?sfQueryTermInfo=1+10+30+archiv+compress+file+multipl

After trying out the script given on the post, I found it took all my 56 files and put it into 1 zip files instead of 56 individual zip files.

The 56 files files I need to turn into individual zip files is only 1 folder of many.
Anyone have any ideas?
thanks
0
Comment
Question by:itkamisama
  • 3
  • 3
7 Comments
 
LVL 33

Expert Comment

by:knightEknight
ID: 35219317
download gzip.exe off the net (easy to google & find).  By default it compresses each file individually.  Example:

  gzip.exe  *.txt
0
 
LVL 52

Expert Comment

by:Bill Prew
ID: 35219929
Can you elaborate a little more?  

It sounds like you have many folders with many files in each, and you want each file to be in a separate ZIP file?  

Where do you want the resulting ZIP file to be located?  

And what ZIP tool do you want to use, 7zip, or something else?  

Will you process just one folder at a time, or are they all subfolders of some common parent, and you want to process the whole tree with one execution of a script?

~bp
0
 
LVL 1

Author Comment

by:itkamisama
ID: 35220189
I will try to download the file and try it.

To be more specific, I have a bunch of graphic files,which each needs to be zipped individually for upload to an online store. The name  convention is as easy as file01, file02...

As far as saving the files,any place on the PC is fine.
0
Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

 
LVL 1

Author Comment

by:itkamisama
ID: 35235525
I downloaded gzip and was trying to find some documentation that would help me with my situation. Unfortunately I could not find any.
Naturally my next question is: "How do I use this?"
0
 
LVL 52

Accepted Solution

by:
Bill Prew earned 500 total points
ID: 35236217
If you want to do it with 7-Zip this script should work.  Just adjust the path to the 7-Zip executable at the top, as well as the paths to the input and output folder names.  Save as a BAT file and run from a command prompt.

@echo off

REM Adjust path to 7Zip program as needed below
set "z=c:\program files\7-zip\7z.exe"

REM Set source and destination folder names
set FromDir=x:\EE\EE26912795\source
set DestDir=x:\EE\EE26912795\dest

REM Zip each file to its own zip file
for %%A in ("%FromDir%\*.*") do (
  "%z%" a -tzip "%DestDir%\%%~nA.zip" "%%~A"
)

Open in new window

~bp
0
 
LVL 1

Author Closing Comment

by:itkamisama
ID: 35236403
Genius!!! Thanks
0
 
LVL 52

Expert Comment

by:Bill Prew
ID: 35237147
Glad that was helpful, thanks.

~bp
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

New Windows 7 Installations take days for Windows-Updates to show up and install. This can easily be fixed. I have finally decided to write an article because this seems to get asked several times a day lately. This Article and the Links apply to…
When you try to share a printer , you may receive one of the following error messages. Error message when you use the Add Printer Wizard to share a printer: Windows could not share your printer. Operation could not be completed (Error 0x000006…
In this Micro Tutorial viewers will learn how to use Boot Corrector from Paragon Rescue Kit Free to identify and fix the boot problems of Windows 7/8/2012R2 etc. As an example is used Windows 2012R2 which lost its active partition flag (often happen…
This Micro Tutorial will teach you how to change your appearance and customize your Windows 7 interface to your unique preference. This will be demonstrated using Windows 7 operating system.

914 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now