So this one's a multi-parter (Windows 7).
I have a folder structure as so:
C: SyncFolder Backups [User] FolderA Subfolder1 Subfolder2 FolderB Subfolder3
My aim is to use the folder 'SyncFolder' as a backup system for certain files (Sync folder is actually a folder placed there by a file syncing service).
At present, I have the following within the Sync folder:
- a .bat file containing a ROBOCOPY command (which copies 1 file)
- a .vbs file which is used to call the .bat file (to avoid the CMD window appearing). This VBS file is being called once per hour by Windows Task Scheduler
- the file which is being copied
So here are my questions:
I'm looking for a code (preferably an edit to the existing .bat, as I'm not overly-technical) which can:
- Copy Subfolder1 in its entirety into a .zip file, which is named YYYYMMDDHHMM_SubFolder1_Backup (where the date & time is automatically populated)
- Move the newly-created .zip file to SyncFolder\Backups (or create it there in the first place?)
- Deletes (or overwrites?) the previous backup
- Repeats for each Subfolder specified (perhaps as an additional command line?) -- I'm not expecting the commands to identify the folders. I would specify the folders myself
- Logs the details of the backup to a .log file located in SyncFolder (i.e. Name of .zip created, Date&Time of backup, size of .zip created)
I'm aware this might be a bit ambitious for CMD or a .bat, but I'm open to any suggestions, but please do bear in mind that I'm not highly technical, so any walk-throughs would be immensely appreciated!
Edit:
Here is my attempt with the .bat code:
@echo off
robocopy "C:\[USER]\[FolderA]\[SubFolder1]" "C:[SyncFolder]\Backups\BackupTest1.zip" *.* /dcopy:T /r:5 /w:5 /log+:"C:\[SyncFolder]\CopyLog.log" /bytes /ts /np
... I've tried this, without luck. This command works, but only creates a folder named BackupTest1.zip (which isn't actually a .zip).