Backup Script

I would like to create a backup of a folder(and its sub-folders) to a rar file

The rar file should be the same name as the one earlier. so it means that we need to re-fresh the files and add new files.
The rar file when done should be moved to a specific location.

Thank you
Pierre AmmounIT ConsultantAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

NVITEnd-user supportCommented:
- Adjust RarFile, TgtDir and LogFile to your needs
@echo off
set RarFile=C:\test\test2.rar
set TgtDir=C:\MoveToThisFolder
set LogFile=%temp%\RarBackup.log
if not exist "%TgtDir%\" (
  echo Missing target folder >>"%LogFile%"
  echo Missing target folder & goto :eof
  ) else (
  rar u -r "%RarFile%" *
  move /y "%RarFile%" "%TgtDir%"
  echo Moved "%RarFile%" to "%TgtDir%" >>"%LogFile%"

Open in new window


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Pierre AmmounIT ConsultantAuthor Commented:
NewVillageIT Thanks for the script.

2 small notes:

1- the parameters u updates files in the archive. Does it mean that if new files are created the are also added to the archive ? I am confused about the parameter f (freshen files )
2-How can I create recovery volumes so that I am certain that the files will be extracted ?

3- How can I change the compression level ?

4-I need the logfile (so that I can make sure that the command executed to be store on a separate folder (dropbox folder)

Thanks a lot !
NVITEnd-user supportCommented:
Hi pa66...

Do still need help with questions in your last post?
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Storage Software

From novice to tech pro — start learning today.