Advertisement
ibi

autosave.cmd

ibi
Feb 2nd, 2022 (edited)
1,302
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Batch 1.87 KB | None | 0 0
  1. @echo off
  2. rem * autosave (was robosave)
  3. rem - robocopy sync of personal files (non-hidden, non-system) to NAS, (c)ibi 2012-22, v22.0129
  4. rem - runs at login (optional: logoff/scheduler/manual)
  5.  
  6. setlocal
  7. echo === AutoSave will backup %userprofile%
  8.  
  9. set nasdir=\\piggy\ssd\autosave\%computername%\%username%
  10. set logfile=\\piggy\ssd\logs\autosave%computername%.log
  11. set rcparam=/mir /s /dst /fft /xj /xa:sh /r:2 /w:5 /np
  12.  
  13. rem *** if share not available then quit
  14. if not exist \\piggy\ssd (echo checking share: failed && exit /b) else (echo checking share: OK)
  15.  
  16. rem *** robocopy large files/dirs
  17. robocopy %userprofile%\pictures %nasdir%\pictures %rcparam% /log:%logfile%
  18. robocopy %userprofile%\music %nasdir%\music %rcparam% /log+:%logfile%
  19. robocopy %userprofile%\videos %nasdir%\videos %rcparam% /log+:%logfile%
  20. rem *** special treatment for downloadfolder
  21. rem move /y %userprofile%\downloads\*.* %nasdir_bck%\downloads\
  22.  
  23. rem *** zip mydocuments
  24. c:\apps\7z\7za.exe u -r -y -up0q0y2 -ms=off -w%temp% -x@c:\apps\7z\exclude_list.txt %nasdir%\docs%computername%_%username%.7z "%userprofile%\*.*"
  25.  
  26. rem *** zip appdata
  27. c:\apps\7z\7za.exe u -r -y -up0q0y2 -ms=off -w%temp% -x!temp\*.* -x!*cache* -x!package* "%nasdir%\appdata\local.7z" "%userprofile%\appdata\local\*.*"
  28. c:\apps\7z\7za.exe u -r -y -up0q0y2 -ms=off -w%temp% "%nasdir%\appdata\locallow.7z" "%userprofile%\appdata\locallow\*.*"
  29. c:\apps\7z\7za.exe u -r -y -up0q0y2 -ms=off -w%temp% "%nasdir%\appdata\roaming.7z" "%userprofile%\appdata\roaming\*.*"
  30.  
  31. rem *** zip batches & other
  32. c:\apps\7z\7za.exe u -r -y -up0q0y2 -ms=off %nasdir%\batches%computername%.7z "c:\apps\-batches\*.*"
  33. if exist c:\apps\bc4 (c:\apps\7z\7za.exe u -r -y -up0q0y2 -ms=off %nasdir%\bc4%computername%.7z c:\apps\bc4\bc*.xml)
  34.  
  35. rem *** sysinfo & appsdir
  36. systeminfo > %nasdir%\si%computername%.txt
  37. dir c:\apps /ogn > "%nasdir%\apps_%computername%.txt"
  38.  
  39. endlocal
  40.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement