Here's what I did:
1. Setup a Google Account for backups (backup@mydomain.com)
2. On a server that we use for local backup, I setup the Google Drive Sync tool to sync a certain folder where my local backups would be housed.
3. Then setup this folder as a share on the server giving out appropriate access.
Now essentially anything copied into that share will get synced straight to Google Drive
Here's were a Custom System variable comes in:
We need to create a script that will copy a folder, but in order to have multi-day backups. instead of just keeping the same folder name, we need the content copied to a new folder with a varied name of some sorts. I just used dates.
This site gave me direction on setting up a custom variable in Windows, which would create the folders based on date.
Here's the command that needs to be issued from an elevated command prompt:
SET FDATE=%DATE:~4,2%.%DATE:~7,2%.%DATE:~10,4%
This set's a system variable, where if you now type in %fdate% in the command prompt you'll get a return like:
The 12.15.2015 is what we want to create the folder name for that day's backup.
Now we just need to write the Script...
A variant of this script will suffice:
XCOPY "C:\Documents and Settings\admin_lbds.LBDS\Desktop\test" "C:\Documents and Settings\admin_lbds.LBDS\Desktop\%FDATE%" /I /E
and the folder with the content appears...
You must reset the variable each time in the script, so a functional batch file could look like this:
_______________________________________________________________________________
SET FDATE=%DATE:~4,2%.%DATE:~7,2%.%DATE:~10,4%
XCOPY "E:\SageFR50 Share" "\\ncsv01\backup$\Sage\%FDATE%" /I /E
_______________________________________________________________________________
You just have to make sure that the xcopy script copies the new folder into your Google Drive sync folder, and voila.
Just create a scheduled task to run the script as often as you'd like.
No comments:
Post a Comment