Skip to content

Instantly share code, notes, and snippets.

@eurica
Created February 3, 2011 06:10
Show Gist options
  • Save eurica/809110 to your computer and use it in GitHub Desktop.
Save eurica/809110 to your computer and use it in GitHub Desktop.
My automated backup script
@rem Simple recursive backup script dave@euri.ca 2011
@echo off
rem I strongly recommend backing up to a different drive or machine
set sourcedir=c:\projects
set destdir=g:\autobackups\projects
for /f "tokens=1-3 delims=/ " %%g in ('date /t') do (
set mm=%%g
set dd=%%h
set yy=%%i
)
@echo on
xcopy %sourcedir% "%destdir%\backup-%yy%-%mm%" /V /E /D /C /I /Y > "%destdir%\lastbackup.txt"
@echo off
@rem XCOPY: Copies files and directory trees.
@rem /V Verifies the size of each new file.
@rem /D Copies only those files whose source time is newer than the destination time.
@rem /E Copies directories and subdirectories, including empty ones.
@rem /C Continues copying even if errors occur.
@rem /I Create destination if it deosn't exist
@rem /Y Suppresses prompting to confirm to overwrite
@Archivet
Copy link

Man, on point....

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment