Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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.



should become

   file2.ext containing file1.ext and file2.ext
      file4.ext 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
@untore What Windows version are you using? Maybe Powershell (Windows 7) is also an option? – nixda Jul 2 '13 at 8:53


  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

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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .