Search code examples
filebatch-filearchiverar

How do I add to an existing Rar Archive with a Batch file?


I have just got a network cloud (NAS) drive. I am backing up files and so on but like to use batch files for quick and easy backups locally.

I am creating several archives (.rar) to include several different folders - i.e. "e:\folder1", "e:\folder2", etc. including all subfolders and files.

Then, once they are set up I want to run a batch file to scan the relevant folders and add to each related archive any files that have subsequently been copied to the folders.

e.g. Folders:

e:\digitalimages\2014\photos (and subfolders) - into archive "2014 Photos"
e:\digitalimages\2014\videos (and subfolders) - into archive "2014 Videos"
e:\digitalimages\2015\photos (and subfolders) - into archive "2015 Photos"
e:\digitalimages\2015\photos (and subfolders) - into archive "2015 Photos"

run a batch file to scan the e:\digitalimages\2014\photos folder and add any newer files to archive "2014 Photos".

Does this make sense? Is it possible?


Solution

  • You can use WinRAR's a command to simply add files to an existing archive.

    "C:\Program Files\WinRAR\rar.exe" a -r "2014 Photos.rar" E:\digitalimages\2014\photos