I am trying to use WinRAR to compress all my different folders individually.
Example of folder content before
c:\projects\test
c:\projects\country
c:\projects\db
and after running the batch file
c:\backup\test.rar
c:\backup\country.rar
c:\backup\db.rar
I am trying the following command in a batch file. But it compresses all the folders in the projects folder being into the backup archive:
for /f "delims==" %%D in ('DIR C:\projects /A /B /S') do (
"C:\Program Files\WinRAR\WinRAR.EXE" m -r "c:\backup\projects.rar" "%%D"
)
c:\backup\projects.rar contains all the files which I want in separate archives.
How to modify the 3 lines in batch file to get the desired archives?
I think you need to change a couple things.
/Ato/ADto get just the directories./Sso you will only get the top-level directories inC:\Projects.FORloop, change the"c:\backup\projects.rar"toC:\Backup\%%D.rar"WARNING: This code is untested.