Page 1 of 1
Exempt Folder while creating rar
Posted: 25 Mar 2014 22:46
by zagix
Hi,
I want to skip/exempt a folder when creating rar files from c:\Database to my destination folder.
Folder to exempt named Local
Code: Select all
@echo off
pushd C:\Database
For /F "delims=" %%G IN ('dir /ad /b') do (
pushd "%%G"
For /F "delims=" %%H IN ('dir /ad /b ^| find /V "Archived"') do (
"C:\Program Files\WinRAR\Rar" a -r "F:\BackupMarch\%%H.rar" "%%H"
)
POPD
)
popd
Re: Exempt Folder while creating rar
Posted: 25 Mar 2014 22:51
by foxidrive
Does Winrar have an exclusion switch?
Re: Exempt Folder while creating rar
Posted: 26 Mar 2014 03:27
by Compo
Since the directory you are wishing to exclude is named Archived, then I'd suggest that it and its contents have the archive attribute set. With that set you would find it easier to exclude from your operations, (I would certainly expect an exclude specific attribute switch in your archiving/compression software).
Re: Exempt Folder while creating rar
Posted: 26 Mar 2014 05:03
by Squashman
I know Winzip has an exclusion switch. Has for over 10 years. I would look at the switches for RAR.exe and see if there is an option for that.
Re: Exempt Folder while creating rar
Posted: 26 Mar 2014 06:10
by foxidrive
This change below will exclude the local folder as well as the archived folder.
findstr /i /b /e /V "Archived local"Code: Select all
@echo off
pushd C:\Database
For /F "delims=" %%G IN ('dir /ad /b') do (
pushd "%%G"
For /F "delims=" %%H IN ('dir /ad /b ^| findstr /i /b /e /V "Archived local"') do (
"C:\Program Files\WinRAR\Rar" a -r "F:\BackupMarch\%%H.rar" "%%H"
)
POPD
)
popd
Re: Exempt Folder while creating rar
Posted: 26 Mar 2014 06:24
by Squashman
I just looked at the documentation and RAR does have a -x switch just like Winzip.
Re: Exempt Folder while creating rar
Posted: 26 Mar 2014 06:29
by foxidrive
Thanks Squashman.
Re: Exempt Folder while creating rar
Posted: 26 Mar 2014 09:00
by Compo
I couldn't dispute the -X switch existing since I do not use the program nor it's manual, but I got the impression from a quick web search that perhaps that switch only exists or existed in some version(s). [/i]It would be ridiculous to not have such a feature however.[/i]
Re: Exempt Folder while creating rar
Posted: 26 Mar 2014 16:08
by carmine
Hi,
Thanks to all for supporting.
The -x switch in my case works.
Thanks a lot.