Elad Benda
Elad Benda

Reputation: 36656

How to write script that `rar`s a folder and all its content recursively?

I currently have the following script:

mkdir \\file-srv\Archive\Products\Web\AccountsServices\Account.Toolbar\Nightly\Accounts-4.2-TC-new\%system.build.number%
xcopy /I /E /Y %env.working_directory%\Deployment\Account\Release\*.* \\file-srv\Archive\Products\Web\AccountsServices\Account.Toolbar\Nightly\Accounts-4.2-TC-new\%system.build.number%

What script should I add to create a rar of that folder aside the

\file-srv\Archive\Products\Web\AccountsServices\Account.Toolbar\Nightly\Accounts-4.2-TC-new\%system.build.number%

(same level)

Upvotes: 0

Views: 1707

Answers (1)

Adriano Repetti
Adriano Repetti

Reputation: 67080

I suppose you have WinRar installed so you can use its command line (and it's path is in the PATH environment variable otherwise you have to specify the full path).

This will create a file named %system.build.number%.rar (with the right name :)) in the \\file-srv\Archive\Products\Web\AccountsServices\Account.Toolbar\Nightly\Accounts-4.2-TC-new\ folder with all files from %env.working_directory%\Deployment\Account\Release\*.* including all its sub-directories.

rar a -r -y \\file-srv\Archive\Products\Web\AccountsServices\Account.Toolbar\Nightly\Accounts-4.2-TC-new\%system.build.number%.rar %env.working_directory%\Deployment\Account\Release\*.*

Upvotes: 2

Related Questions