Last active
November 4, 2017 14:43
-
-
Save m5wdev/e8d87bbead88449b54a10621d690eb17 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
:: By DeN www.m5-web.com | |
@echo off | |
:: Hour | |
set year=%date:~-4% | |
:: Mounth | |
set mounth=%date:~-7,2% | |
:: Day | |
set day=%date:~-10,2% | |
:: Hour | |
set hour=%time:~0,2% | |
:: Remove leading space if single digit | |
if "%hour:~0,1%" == " " set hour=0%hour:~1,1% | |
:: Minutes | |
set min=%time:~3,2% | |
:: Remove leading space | |
if "%min:~0,1%" == " " set min=0%min:~1,1% | |
:: Seconds | |
set secs=%time:~6,2% | |
:: Remove leading space | |
if "%secs:~0,1%" == " " set secs=0%secs:~1,1% | |
:: My custom date format for backup folder | |
set fdate=[%day%-%mounth%-%year%_%hour%h%min%m%secs%s] | |
:: https://www.techrepublic.com/article/how-to-quickly-back-up-just-your-data-in-windows-10-with-robocopys-multi-threaded-feature/ | |
Robocopy "C:\Users\DeN\Dropbox" "D:\Dropbox_Backups\Dropbox_%fdate%" /MIR /XA:SH /XJD /R:5 /W:15 /MT:32 | |
Robocopy "C:\Users\DeN\Dropbox" "E:\Dropbox_Backups\Dropbox_%fdate%" /MIR /XA:SH /XJD /R:5 /W:15 /MT:32 | |
:: Let's go and clean our old backups | |
START /D "D:\Dropbox_Backups" FORFILES /S /D -15 /C "cmd /c IF @isdir == TRUE rd /S /Q @path" | |
START /D "E:\Dropbox_Backups" FORFILES /S /D -15 /C "cmd /c IF @isdir == TRUE rd /S /Q @path" | |
pause | |
:: By DeN www.m5-web.com |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment