Jump to content

RAR folders/subfolders/files into separate rar archive files


XtremeMaC

Recommended Posts

this is an example folder structure:

c:\PICTURES\folderAA\

c:\PICTURES\folderAA\01\
c:\PICTURES\folderAA\01\*many many files*.jpg

c:\PICTURES\folderAA\02\
c:\PICTURES\folderAA\02\*many many files*.jpg

c:\PICTURES\folderAA\03\
c:\PICTURES\folderAA\03\*many many files*.jpg



c:\PICTURES\folderBB\

c:\PICTURES\folderBB\01\
c:\PICTURES\folderBB\01\*many many files*.jpg

c:\PICTURES\folderBB\02\
c:\PICTURES\folderBB\02\*many many files*.jpg

c:\PICTURES\folderBB\03\
c:\PICTURES\folderBB\03\*many many files*.jpg

and this is the rar files that i want to create:

c:\PICTURES\folderAA\
c:\PICTURES\folderAA\01.rar
c:\PICTURES\folderAA\02.rar
c:\PICTURES\folderAA\03.rar

c:\PICTURES\folderBB\
c:\PICTURES\folderBB\01.rar
c:\PICTURES\folderBB\02.rar
c:\PICTURES\folderBB\03.rar

no folderAA/folderBB.rar no pictures.rar

so far I've gotten this:

for /F  %%f in ('dir /aD /B') do (rar a  -r -cl -m0 -df -md64 -ee -ep %%f.rar %%f\*.*)
for /F %%f in ('dir /aD /B') do rd %%f /Q >>I use this to delete the sub folders...

in rar command line switches -r means Recurse subdirectories

now I can place the batch file into folderAA and folderBB folders manually and run them manually. it works.

but i've lots of folders under PICTURES folder so i really don't want to do this manually.

now I tried to put

for /F "eol= delims=" %%A IN (dir.txt) do rar.....

but then I get folderAA.rar having the contents of folder 01/02/03..

I tried to put several variables with tokens but i wasn't able to get anywhere..

dir.txt contents are are shown above..

I know if i put more hours to this I can figure it out but i know there are batch gurus that'll make this in matter of seconds :)

so help please. TIA

Edited by XtremeMaC
Link to comment
Share on other sites


Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...