Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I am trying to write a batch script that when run into a folder, it takes all the files in this folder and zip them into one, then takes the remaining folders and looks into them and do the same, saving the zip files into each folder.

Example:

folder1
   file1.ext
   file2.ext
   folder2
      file3.ext
      file4.ext

should become

folder1
   file1.ext
   file2.ext
   folder1.zip containing file1.ext and file2.ext
   folder2
      file3.ext
      file4.ext
      folder2.zip containing file3.ext and file4.ext
share|improve this question
    
I have added an example to your question to make it better understandable. You did not specify what names the ZIP files need to have. Feel free to revert my edit. –  Jan Doggen Jul 2 '13 at 8:47
1  
@untore What Windows version are you using? Maybe Powershell (Windows 7) is also an option? –  nixda Jul 2 '13 at 8:53
add comment

2 Answers

WinRAR!

  1. Select all folders
  2. Right click> Add to Archive
  3. In WinRAR options go Files tab
  4. In the bottom Archive section, select "Put each file to separate archive"
  5. Ok.

Now every folder will be created into new RAR or Zip archive.

share|improve this answer
add comment

If you have UNIX background you can install Cygwin and write a Bash script to descend directories recursively invoking a Cygwin zip command, or any other zip command line interface (CLI) program.

You can also install Python and that way is even simpler a script to recursive descent. Each step can make a call to a CLI zip program.

You can probably use the Powershell, but am not sure how easy can be used to recursive descending.

share|improve this answer
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.