![]() Using either of these utilities to automate archiving needs is fairly easy to do, costs nothing, and saves time. This guide covers the use of two free archiving utilities, the command-line add-on utility for IZArc and the standalone console version for 7-Zip. For using the WinRAR command-line tools, see this post.Īutomating compression tasks using batch files or other scripting languages makes it simple and fast to compress, copy, rename, and move files from the same folder(s) when it’s necessary to do so on a regular basis. ![]() Rem C:\blat\blat262\full\blat -subject "BATCH: backup1 inc backup for %mydate%." -bodyf "\\remote_server\share\backup_path\%mydate%\log.txt" -server \\mailserver -f AccountToSendTo -tf c:\ListOfAdmins2Email.This guide demonstrates how to automate repetitive compression tasks using batch files with two popular free archiving tools, the command-line utility for IZArc (freeware) and the standalone console version of 7-Zip (7-Zip Extra: standalone console version). ![]() Rem email changed files log from offsite server. %rc% /copy:dat /e /z /r:5 /w:5 %backupdir%\%mydate% "\\remote_server\share\backup_path\%mydate%" Rem copy compressed file and log to offsite server. If exist %tempdir%\temp\path %zcmd% %backupdir%\%mydate%\backup1.7z %tempdir%\temp\path\*.* %rc% \\server1\source\path %tempdir%\temp\path *.* /s /z /copy:dat /maxage:1 /r:5 /w:5 /log:%backupdir%\%mydate%\log.txt /np Set zcmd="c:\program files\7-zip\7z" a -t7z -r -mx=7 -ssw -mtc=on If you need any clarification on switches or why I chose the switches I did, feel free to ask. At any rate, I hope it will be good enough to get started down the right direction to a script that will meet your requirements. ![]() I hope cleaning the script up (removing server names and so on) I didn't break it, and I never had much time to polish up the script so it is crude. (I planned to automate is checking if I had time.) (Having a script like this won't detect if files were deleted because incremental backups would show no files added.) If the current hash and previous hash are the same, I delete newest backup because nothing had changed since then. In my full backup script, I have the script hash the archive so I can manually compare the hashes of the last two full backups to see if they are the same. I had planned to add empty directory detection, or if nothing else do a hash and compare to an empty 7z archive hash and if the match then delete the newly created empty 7z archive. One problem I hadn't fixed in the script is if no files have changed, a 7z file of 32k in size is still created (an empty 7z archive). The /maxage:1 part of the script is what limits to things what had change within a day. You should be able to change that to how you want things labeled. The date format is different than you asked for, chose YYYY-MM-DD because then things would sort well in Windows Explorer. I'm not a programmer, but I'm the "computer guy", so I just know more than most I work with. Right from the go I want to say I'm not batch script ninja, but through reading websites I was able to kluge something together that seem to work good enough. ![]() What I've done to get files that changed that day was use Robocopy to copy the newly modified files to a temporary directory and then 7zip that. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |