Backing up files at logoff

Geoff

VIP Member
This question may be a bit vague, but hopefully you get what im saying.

I want to create a batch file so that when i logoff, it copies the "Favorites" and "My Documents" folder from the family computer to another computer on the network. I know how to get a script to run at logoff, but im not firmiliar with creating batch files, so if you could help me out that would be great.

Some info you may need:
Family Computer: Network Name- FAMILYCOMPUTER, Workgroup- MSHOME, OS- Windows XP Pro w/SP2.

Backup Comp: Network Name- GEOFFSERVER, Workgroup- MSHOME, OS- Windows XP Pro w/SP2.
 
the command you'll need is xcopy i think
http://www.computerhope.com/xcopyhlp.htm
i made a batch file that backed up my pen drive before, but i think i've deleted it, if i find it i'll put it on to show you what is needed

Omega, would you mind telling me where i can find info about running a script at logoff, or how to do it as a can never remember to backup, that would make it so much easier for me

Thanks, Lee :D
 
Oh i already found out how to make one, i'll post it here incase any of you were interested in the script:

Code:
@echo off
:: variables
set drive=C:\BACKUPS
set backupcmd=xcopy /s /c /d /e /h /i /r /k /y


echo THIS IS AN AUTOMATED BACKUP, IF YOU EXPERIENCE LONG PAUSES IT IS MOST LILKELY 
echo BECAUSE IT IS BACKING UP A LARGE FILE.
echo .
echo .
echo .
echo .

echo #### Backing up Favorites...
rmdir /s/q "%drive%\Joanne\Favorites"
%backupcmd% "C:\Documents and Settings\Joanne\Favorites" "%drive%\Joanne\Favorites"
echo ****** Favorites... Complete! ******
echo .
echo .


echo #### Backing up the Registry...
if not exist "%drive%\Registry" mkdir "%drive%\Registry"
if exist "%drive%\Registry\regbackup.reg" del "%drive%\Joanne\Registry\regbackup.reg"
regedit /e "%drive%\Registry\regbackup.reg"
echo ****** Registry... Complete! ******
echo .
echo .


echo #### Backing up My Documents...
rmdir /s/q "%drive%\Joanne\My Documents"
%backupcmd% "C:\Documents and Settings\Joanne\My Documents" "%drive%\Joanne\My Documents"
echo ****** My Documents... Complete! ******
echo .
echo .


echo #### Backing up MSN Data...
rmdir /s/q "%drive%\Joanne\MSN Data"
%backupcmd% "C:\Documents and Settings\Joanne\Local Settings\Application Data\Microsoft\MSN" "%drive%\Joanne\MSN Data"
echo ****** MSN Data... Complete! ******
echo .
echo .


echo Backup Complete!
That code is set so it deletes the files first, then it copies the new files to it. Just change the targets to whatever your folder/drives are.

And i use Tune-Up Utilities 2006 and have it run the script at Log on.
 
That code is set so it deletes the files first, then it copies the new files to it.
should really be the other way around geoff, that way if the script is interupted you still have a copy
 
apj101 said:
should really be the other way around geoff, that way if the script is interupted you still have a copy
Not really, since before i added the delete code it only copied new files, it didnt copy over existing files. So now its set to delete the contents of a folder, then copy the content of that folder to the backup one.
 
still there is a moment when your entire backup is deleted and before the new one is created.
Also the process could be optomised to use the time modified stamp of the file to remove the need to save all the file. There are lots of freeware sync programs out there
http://www.dirfile.com/freeware/synchronization.htm

also note, that the way you system is set up is almost like a mirroring effect, albeit delayed to times between log off. What if you screw up, delete the wrong file, but dont notice untill a few log offs later.
You could re work the script to keep say 10 zipped backups. And maybe say keep the back up from Sundays for 1 months, then remove. That way you have a rolling log of changes to the file.
 
Back
Top