Created
April 4, 2016 01:48
-
-
Save kfparri/e23f3e561d90487aa6cb90aaa853c3ee to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
:: Don't echo all the text to the command window | |
@echo off | |
:: Create a copy from D:\ImportantStuff\Pictures directory to the local directory HomeBackups\Pictures | |
:: Robocopy's /mir switch will only copy files if they change or don't exists in the destination directory | |
robocopy D:\ImportantStuff\Pictures HomeBackups\Pictures /mir | |
:: Copy D:\Music to HomeBackups\Music | |
robocopy D:\Music HomeBackups\Music /mir | |
:: Create a variable with the current date in the format 'yyyy-mm-dd' | |
For /f "tokens=2-4 delims=/ " %%a in ('date /t') do (set mydate=%%c-%%a-%%b) | |
:: Create a variable with the current time in it | |
For /f "tokens=1-2 delims=/:" %%a in ('time /t') do (set mytime=%%a%%b) | |
:: Write the current date and time to a file named lastBackup.txt. | |
:: This file will store the time of the last successful backup | |
echo %mydate%_%mytime% > lastBackup.txt |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment