ibi icon

autosave.cmd

ibi | PRO | 02/02/22 09:59:12 AM UTC (Edited) | 0 ⭐ | 1629 👁️ | Never ⏰ | []
Batch |

1.87 KB

|

None

|

0 👍

/

0 👎

@echo off
rem * autosave (was robosave)
rem - robocopy sync of personal files (non-hidden, non-system) to NAS, (c)ibi 2012-22, v22.0129
rem - runs at login (optional: logoff/scheduler/manual)
 
setlocal
echo === AutoSave will backup %userprofile%
 
set nasdir=\\piggy\ssd\autosave\%computername%\%username%
set logfile=\\piggy\ssd\logs\autosave%computername%.log
set rcparam=/mir /s /dst /fft /xj /xa:sh /r:2 /w:5 /np 
 
rem *** if share not available then quit
if not exist \\piggy\ssd (echo checking share: failed && exit /b) else (echo checking share: OK)
 
rem *** robocopy large files/dirs
robocopy %userprofile%\pictures %nasdir%\pictures %rcparam% /log:%logfile%
robocopy %userprofile%\music %nasdir%\music %rcparam% /log+:%logfile%
robocopy %userprofile%\videos %nasdir%\videos %rcparam% /log+:%logfile%
rem *** special treatment for downloadfolder
rem move /y %userprofile%\downloads\*.* %nasdir_bck%\downloads\
 
rem *** zip mydocuments
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%\*.*"
 
rem *** zip appdata
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\*.*"
c:\apps\7z\7za.exe u -r -y -up0q0y2 -ms=off -w%temp% "%nasdir%\appdata\locallow.7z" "%userprofile%\appdata\locallow\*.*"
c:\apps\7z\7za.exe u -r -y -up0q0y2 -ms=off -w%temp% "%nasdir%\appdata\roaming.7z" "%userprofile%\appdata\roaming\*.*"
 
rem *** zip batches & other
c:\apps\7z\7za.exe u -r -y -up0q0y2 -ms=off %nasdir%\batches%computername%.7z "c:\apps\-batches\*.*"
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)
 
rem *** sysinfo & appsdir
systeminfo > %nasdir%\si%computername%.txt
dir c:\apps /ogn > "%nasdir%\apps_%computername%.txt"
 
endlocal
 

Comments