Use 7z+*.BAT to backup at work
Following the previous post, I apply the application, 7z (http://www.7-zip.org/), instead this time. The reason is obvious: sometimes our work environment might not allow us installing WinRar.
The major differences are
The major differences are
- 7zip doesn't support auto-seed in parameter (in another word, 7zip will replace the file with the same file name because of using "a" in parameter). Therefore, I have to get the "seeds" from current time.
- 7zip will show the detail during the compressing process (i.e. print out every file name). Thus I use the command script to output the detail into a TXT file, log.txt.
@echo off SETLOCAL @ECHO Begin to backup for /F "tokens=1-3 delims=/ " %%i in ('date /t') do ( set strPre=%%i%%j%%k ) for /f "tokens=1-3 delims=:." %%i IN ("%time%") DO ( set strseed=%%i%%j%%k ) "C:\Program Files\7-Zip\7z.exe" a -t7z -mx=7 -ssw <target path>\%strPre%_%strseed% <source path>\* >> log.txt @ECHO End backup ENDLOCAL
留言