Land Of Oorang

Or "Things Only I Will Think Are Important"

Blog

Tuesday 2/9/2009 - Batch Backup Script

Posted by Oorang on June 5, 2009 at 5:37 AM Comments comments (0)

Ok, here is a little quickie you can throw into a bat file and use to back up your data. I kind of like this one because it actually only backs up items that have changed (using the archive bit)

 

@Echo Off
xcopy "%USERPROFILE%\My Documents\*" U:\ /e /h /y /a
attrib -A "%USERPROFILE%\My Documents\*" /S /D
Echo Backup Complete
Pause


What It Does

This example backs up all files and sub directories in My Documents of the current user to the drive "U:".If the archive flag is set.Then it removes the archive flag for all files and folders (since they have now been backed up). If you change any of the files or add them,windows will reset the archive flag and your backup script will grab all changes. Nice and simple:)