@echo off echo jsbkwin 12-07-11 :: INSTRUCTIONS: :: Save this file to it. Remove the .txt from the name. :: Download blat http://www.blat.net/ and copy the 3 files (blat.exe, blat.dll, blat.lib) into c:\winnt or c:\windows :: Ideally, blat will just send the mail. But more and more ISP's are blocking this. You can request that your ISP allow smtp or send on another port or use a remote mail server. :: Use http://www.stunnel.org/ to make secure (tls) connections for sending mail. See example stunnel.conf at bottom :: Also, http://www.cygwin.com/ for rsync, ssh and unix2dos on windows. :: Edit file according to your needs and run. :: This can be run automatically with "at" or "scheduled tasks", :: You can uncomment the pause's for debugging. ::uncomment options as needed (connecting to outside MTA, for example) set to="" set from="" set smtp_server="127.0.0.1" ::set smtp_port="4465" ::set username="" ::set password="" set subject="Backup logs from %computername%" set log="jsbkwin_log.txt" ::File extensions to be excluded, uncomment and modify as needed. ::echo .avi >> exclude.txt ::echo .mp3 >> exclude.txt echo exclude.txt >> exclude.txt ::XCOPY help :: /s copied recursively except empty dirs :: /e copies empty dirs :: /v verifies file writes :: /y answers yes with out prompt :: /i assumes dirs are dirs (duhh) :: /h copies hidden and system files :: /d copies new or changed files :: /EXCLUDE:[file] files or strings to exclude :: >> %log% 2>&1 redirects standard out and error and appends to log echo. echo Press "X" at top right of window to cancel. echo backup screen will be blank throughout backup process. Check log for echo activity and results. echo log location: %log% ::uncomment "pause" for running manual or troubleshooting ::pause echo. echo ----------BEGIN---------- >> %log% echo Version: %version% >> %log% date /t >> %log% 2>&1 time /t >> %log% 2>&1 echo. echo Backed up files: echo. echo running rsync-mirror backup now >> %log% 2>&1 ::example :: C:\cygwin\bin\rsync -rut --delete --stats "/cygdrive/c/DATA" "/cygdrive/e/daily/rsync-mirror" >> %log% 2>&1 :: C:\cygwin\bin\rsync -rut --delete --stats "/cygdrive/c/MT0" "/cygdrive/e/daily/MT0" >> %log% 2>&1 ::echo. >> %log% 2>&1 ::echo. >> %log% 2>&1 ::echo running new-n-changed backup now >> %log% 2>&1 ::echo. >> %log% 2>&1 :: xcopy /s/e/v/y/i/h/d/EXCLUDE:exclude.txt "c:\DATA" "e:\daily\new-n-changed" >> %log% 2>&1 echo. date /t >> %log% 2>&1 time /t >> %log% 2>&1 echo ----------END---------- >> %log% echo. C:\cygwin\bin\unix2dos.exe %log% echo mail log blat %log% -to %to% -subject %subject% -hostname %computername% -server %smtp_server% -f %from% -port %smtp_port% -u %username% -pw %password% del exclude.txt del %log% echo. echo BACKUP COMPLETE ::uncomment "pause" for troubleshooting ::pause ::stunnel.conf example: ::client = yes ::debug = debug ::[pop3s] ::accept = 127.0.0.1:9995 ::connect = pop3s.myisp.com:995 ::[imaps] ::accept = 127.0.0.1:9993 ::delay = yes ::connect = imaps.myisp.com:993 ::[smtps] ::accept = 127.0.0.1:4465 ::connect = smtps.myisp.com:465