Guest vaderag Posted January 11, 2007 Posted January 11, 2007 I've been reading the backup using batch files wiki (http://www.hak5.org/wiki/Backup_Using_Batch_Files) and was wondering if there is a way to do this, but to compress the results of the backup. I know it can be done by compressing with some command like utility and then backing it up, but i want to be able to do it so that it only needs to update the current archive with things that have changed. Is there a way to do that? Thanks, andy Quote
Deveant Posted January 12, 2007 Posted January 12, 2007 presumably with out looking at the scripts i would say yes, going by what u have said ur only using batch scripts, so it would be able to be done with complements to Winrar Command (included in normal winrar package fow W32) Edit: Just looked over the back up scripts, this now works ^_^ so pretty much as long as the back up places everythin in a given location, say 'G:Backup' then we are able to make a archive of that folder, example; set path="C:Program FilesWinRAR";%path% rar a [Path To Were Rar Will Be Created] [Path To Backup] rmdir %drive% /S /Q So If i had my backups made to 'G:Backup' and i wanted to make G:Backup.rar' i would use the code; @echo off :: variables set drive=G:Backup set backupcmd=xcopy /s /c /d /e /h /i /r /k /y echo ### Backing up My Documents... %backupcmd% "%USERPROFILE%My Documents" "%drive%My Documents" echo ### Backing up Favorites... %backupcmd% "%USERPROFILE%Favorites" "%drive%Favorites" echo ### Backing up email and address book (Outlook Express)... %backupcmd% "%USERPROFILE%Application DataMicrosoftAddress Book" "%drive%Address Book" %backupcmd% "%USERPROFILE%Local SettingsApplication DataIdentities" "%drive%Outlook Express" echo ### Backing up email and contacts (MS Outlook)... %backupcmd% "%USERPROFILE%Local SettingsApplication DataMicrosoftOutlook" "%drive%Outlook" echo ### Backing up the Registry... if not exist "%drive%Registry" mkdir "%drive%Registry" if exist "%drive%Registryregbackup.reg" del "%drive%Registryregbackup.reg" regedit /e "%drive%Registryregbackup.reg" echo Backup Complete! echo Archiving set path="C:Program FilesWinRAR";%path% rar a %drive%.rar %drive% rmdir %drive% /S /Q echo Archiving Complete! @pause Edited again, i just added the line 'rmdir %drive% /S /Q' pretty much just removes the folder it archives after completion. Quote
Guest vaderag Posted January 12, 2007 Posted January 12, 2007 Thanks, I figured that it would be easy enough to do that, but wont that mean that it has to copy over everything each time (not just the stuff that has changed?), especially if we're removing the directory? What I'd like it to do, is to only copy and archive the things that have changed (i.e. not necessarily create a new archive each time?) Does that make sense? Quote
SomeoneE1se Posted January 12, 2007 Posted January 12, 2007 Thanks, I figured that it would be easy enough to do that, but wont that mean that it has to copy over everything each time (not just the stuff that has changed?), especially if we're removing the directory?What I'd like it to do, is to only copy and archive the things that have changed (i.e. not necessarily create a new archive each time?) Does that make sense? yes it does.. you want synctoy from Microsoft it's a powertoy and very cool features theres even a way to have it run in the background I'm to tired to Google it right now if you don't find it by the time i get back I'll find it for ya. Quote
Guest vaderag Posted January 12, 2007 Posted January 12, 2007 Thanks, I figured that it would be easy enough to do that, but wont that mean that it has to copy over everything each time (not just the stuff that has changed?), especially if we're removing the directory?What I'd like it to do, is to only copy and archive the things that have changed (i.e. not necessarily create a new archive each time?) Does that make sense? yes it does.. you want synctoy from Microsoft it's a powertoy and very cool features theres even a way to have it run in the background I'm to tired to Google it right now if you don't find it by the time i get back I'll find it for ya. Found it, but there doesnt seem to be any archiving/compression capabilities? Quote
Deveant Posted January 12, 2007 Posted January 12, 2007 hmm if u still wanna use batch and Winrar, u can simply mod the original back up to do it, also ur right about not copying everythink then adding it to the archive, so ive edited again :P here it is, instead of copying all files to a new folder, it only adds to archive files that have been modified or added to the folders. here we go; @echo off :: variables set path="C:Program FilesWinRAR";%path% set archive=C:Backup.rar echo ### Backing up My Documents... rar u "%archive%" "%USERPROFILE%My Documents" echo ### Backing up Favorites... rar u "%archive%" "%USERPROFILE%Favorites" echo ### Backing up email and address book (Outlook Express)... rar u "%archive%" "%USERPROFILE%Application DataMicrosoftAddress Book" rar u "%archive%" "%USERPROFILE%Local SettingsApplication DataIdentities" echo ### Backing up email and contacts (MS Outlook)... rar u "%archive%" "%USERPROFILE%Local SettingsApplication DataMicrosoftOutlook" echo ### Backing up the Registry... if not exist "%drive%Registry" mkdir "%drive%Registry" if exist "%drive%Registryregbackup.reg" del "%drive%Registryregbackup.reg" regedit /e "C:regbackup.reg" rar u "%archive%" "C:regbackup.reg" del "C:regbackup.reg" /Q echo Backup Complete! Pause Hope this helps. Quote
Guest vaderag Posted January 12, 2007 Posted January 12, 2007 Deveant, thats brilliant - looks like it should do exactly what i need! Thanks very much for your help! :) Quote
Deveant Posted January 12, 2007 Posted January 12, 2007 lol sorry just edited it again, and umm again... and just then 1 more time, this time i tryed it ^_^ works now :P Quote
Guest vaderag Posted January 12, 2007 Posted January 12, 2007 How come you removed the m3 etc? any particular reason or just didnt want to type them out again?! Quote
Guest vaderag Posted January 12, 2007 Posted January 12, 2007 oh, and just one final question - is there a way to exclude a folder in this? I have my photos folder in my documents, and thats about 9GB in itself, so i'd like it to be excluded. If not, no worries, i'll cope! Quote
Deveant Posted January 12, 2007 Posted January 12, 2007 i removed the m3 because on my Machien it wasnt working correctly, just gotta check on somethink with the switch options, as for the exclusion, im rather sure it can be done just need to look into it, which ill be doing now. ill post the new version of the script when ive worked out the bugs ^_^U Quote
Guest vaderag Posted January 12, 2007 Posted January 12, 2007 Thanks alot Deveant - look forward to your response. Think i got the m3 working by putting a '-' before it, so now i have "rar u -ed -m5 -rr" Quote
Guest vaderag Posted January 13, 2007 Posted January 13, 2007 Got the exclusion working with a -x"*path*" Quite strange you need the * before, however it just wouldnt do it without. Guess i'll just have to make sure i dont make a folder called My Pictures as a subfolder of anything else ;) Quote
Guest vaderag Posted January 13, 2007 Posted January 13, 2007 Right, ok, got one final question now. Is there a way to check whether outlook or firefox are running at the start of the backup process, and if they are to exit them (or kill the process), since the PST files wont actually backup when outlook is open, and I usually end up going to bed with it open overnight! Thanks! EDIT: Hell, i'm getting good at this - solved that one myself too! taskkill /F /IM firefox.exe /FI "STATUS eq RUNNING" Quote
Zaza Posted January 16, 2007 Posted January 16, 2007 Was just wondering if there was a way to do this for unknown drive letters (USB device) as at home my USB device is F: and at college it is either G: or I: (annoying I know). To clarify, is there any way in a batchfile to pickup an unkown drive letter. I do however know the name of the device when plugged in, 'JUKE BOX' (excluding single quotes). Quote
Deveant Posted January 17, 2007 Posted January 17, 2007 so ur wanting to back up to ur flash drive, or from ur flash drive? Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.