efficiently backing up your data

Hi there. Since I have to backup like 10 to 15 computer at my job, i was searching for a way to automate this.

What do you need: A source directory and a NAS / EXTERNAL / LAN / OTHER PARTITION drive

here is the little batch script ive written for that purpos.

http://pastebin.com/f7584dd42

So what do you need to do:

make sure you adjust this with your own values:
Quote
:: settings
Set backupFolder=SERVER_1
Set backupLOGFolder=c:\BackupLogs
Set destDir=\\server\backup\%backupFolder%


then just modify the path that should be updated. In the example i backup the mozilla Firefox profiles (for the bookmarks etc)

Just replace the first ARG :"%HOMEDRIVE%\%HOMEPATH%\AppData\Roaming\Mozilla\Firefox\Profiles"

and the second ARG :"%destDir%\AppData\Roaming\Mozilla\Firefox\Profiles"

where the first arg is the source and the second path is the destination.
You may also want to change the Echo message and the logPath / logFile
Quote
:: backup the mozilla profiles
ECHO ">> Backing up the Mozilla Profiles . . ."
robocopy "%HOMEDRIVE%\%HOMEPATH%\AppData\Roaming\Mozilla\Firefox\Profiles" "%destDir%\AppData\Roaming\Mozilla\Firefox\Profiles" /r:1 /w:1 /E /A-:H /NP /V /LOG:%backupLOGFolder%\Firefox.log
cls


This is rly easy fast and handy and a big plus of robocopy is the detailed logging and the MANY options.

Hope this helped some1.

Laters

Thx to jeje for the robocopy > xcopy hint!
Comments
16
just out of curiosity - does it work with directories / names with whitespaces in it? eg. a folder '\testing stuff'. and what does cls stand for?

we had to write a backup script for unix systems at university and those whitespaces seem to be a real pain in the ass for shell scripts.
cls clear screen,

white spaces are no problem (only dont use them in the backup folder Name, or put backup folder name in "")
Parent
ah ok, thanks!
Parent
if you want to exclude more paths with white spaces, add them in more /XD clauses, like:
Quote
:: backup our home path
ECHO ">> Backing up the Home Path, this could take some time . . ."
robocopy "%HOMEDRIVE%\%HOMEPATH%" "%destDir%\Hannes" /r:1 /w:1 /E /A-:H /XD "%HOMEDRIVE%%HOMEPATH%\Netzwerkumgebung" /XD "%HOMEDRIVE%%HOMEPATH%\SendTo" /XD "%HOMEDRIVE%%HOMEPATH%\Searches" /XD "%HOMEDRIVE%%HOMEPATH%\Vorlagen" /XD "%HOMEDRIVE%%HOMEPATH%\StartMenü" /XD "%HOMEDRIVE%%HOMEPATH%\Recent" /XD "%HOMEDRIVE%%HOMEPATH%\Tracing" /XD "%HOMEDRIVE%%HOMEPATH%\Eigene Dateien" /XD "%HOMEDRIVE%%HOMEPATH%\Druckumgebung" /XD "%HOMEDRIVE%%HOMEPATH%\Lokale Einstellungen" /XD "%HOMEDRIVE%%HOMEPATH%\Cookies" /XD "%HOMEDRIVE%%HOMEPATH%\Anwendungsdaten" /XD "%HOMEDRIVE%%HOMEPATH%\AppData" /XF ntuser.* /XF thumbs.db /NP /V /LOG:%backupLOGFolder%\HOMEPATH.log
cls
Back to top