1

I have some files which I would like to be able to archive daily into a zip file that has the date in the filename.

The files to be archived are in one folder, let's call them a, b and c. I would like them to be zipped into a file with the name archiveYYYYMMDD.zip into a second (different) folder where YYYYMMDD is the current date. I'm struggling to come up with a suitable batch file.

I'm running Windows 7 x64 Ultimate. I have a scheduling program which would run the batch file at a preset time every day.

Thanks

Alan

user338034
  • 323
  • 1
  • 3
  • 8
  • 1
    Check [this](https://stackoverflow.com/questions/203090/how-do-i-get-current-datetime-on-the-windows-command-line-in-a-suitable-format/19799236#19799236) and [this](https://stackoverflow.com/questions/28043589/how-can-i-compress-zip-and-uncompress-unzip-files-and-folders-with-bat) – npocmaka Dec 16 '17 at 06:04

1 Answers1

1

This can be done with shareware archiver WinRAR with a single command line:

"%ProgramFiles%\WinRAR\WinRAR.exe" a -afzip -agYYYYMMDD -cfg- -ed -ep1 -ibck -inul -m5 -r -y -- "Path to Backup Folder\Backup_.zip" "Path to Folder to Backup\"

This single command line can be executed directly as scheduled task. There is no need for a batch file.

The help of WinRAR opened by starting WinRAR and clicking in menu Help on menu item Help topics explains under Contents menu item Command line mode the command line syntax, the command a and the used switches.

Mofi
  • 38,783
  • 14
  • 62
  • 115