Compressing folders using Winrar

Associate
Joined
3 Nov 2005
Posts
602
Location
Stoke-on-Trent
Hi Peeps

I have a top level folder say "A" with many subfolders underneath. E.G:

A-
B
C
D
E
.....

Using winrar can I compress the subfolders in a batch (rather than having to do each on manually) into separate archives, so I end up with "b.rar" "c.rar" "d.rar" and so on.


Cheers
 
It'll be tricky to do with winrar but you should have the command line equivalent rar.exe as well. Using that in a simple batch script should do what you need:

Code:
@setlocal
@echo off
set path="C:\Program Files\WinRAR\";%path%
for /D %%i in ('dir /ad/b') do rar a "%%i".rar "%%i"

If you're running Visat64 then you'll probably need to change the set path line to the correct path.
 
Thank you for your help it is appreciated :D

I had to modify the syntax slightly to make it work correctly.

for /D %%i in (*.) do rar a "%%i".rar "%%i"

replacing ('dir /ad/b') with (*.)
 
Back
Top Bottom