Basic Backup Still Eludes Most IT Professionals
by Seth Miller
I can’t believe this is still prevalent among senior level IT professionals. A colleague of mine was literally sweating when his laptop wouldn’t boot up. He was on the verge of losing no less than a half a decade of data. His response to my inquiry of what type of backup of his data he does is “I have never had time to set that up.”
It’s really not that hard and for those of you that have “never had time” or “have been meaning to get to it”, I’ll give you a head start. Since most companies use the Windows operating system on their laptops and PCs, I am using Windows commands.
Chances are, you have your very own cozy little share drive that has been provided you for exactly this type of situation. If it’s already mapped to a drive and persistent across boots…great. Use that drive letter in your script. If the drive is not persistent across boots or not mapped at all, I have that covered too.
Create a batch file in a location that is going to get backed up. Feel free to get fancy with variables, loops and myriad echo statements, or just simply:
xcopy "C:\Users\Dococ\Documents\*" "W:\Documents\" /C /H /E /D /Y
Here is the meaning of each of the xcopy flags being used:
/C Continues copying even if errors occur.
/H Copies hidden and system files also.
/E Copies directories and subdirectories, including empty ones.
Same as /S /E. May be used to modify /T.
/D:m-d-y Copies files changed on or after the specified date.
If no date is given, copies only those files whose
source time is newer than the destination time.
The nice thing about this is it is only going to copy new files and those that have been updated so if you have a lot of files to copy, you don’t have to worry about swamping the network or your PC every time it runs.
Add another line for each directory you want to back up. Be specific about what you want and add another line to the file every time you add something you want to recover or discover a configuration file you want to keep. Here are a few ideas.
xcopy "C:\Users\Dococ\Pictures\*" "W:\Pictures\" /C /H /E /D /Y xcopy "C:\Users\Dococ\Scripts\*" "W:\Scripts\" /C /H /E /D /Y xcopy "C:\Users\Dococ\Putty\*" "W:\Putty\" /C /H /E /D /Y xcopy "C:\Users\Dococ\Putty Sessions\*" "W:\Putty Sessions\" /C /H /E /D /Y xcopy "C:\Program Files (x86)\Vim\*" "W:\Vim\" /C /H /E /D /Y xcopy "C:\Users\Dococ\AppData\Roaming\Microsoft\Templates\*" "W:\Outlook Templates\" /C /H /E /D /Y xcopy "C:\Users\Dococ\AppData\Local\Microsoft\Outlook\archive.pst" "W:\PSTs\" /C /H /E /D /Y xcopy "C:\Users\Dococ\AppData\Roaming\Microsoft\Windows\Libraries\*" "W:\Libraries\" /C /H /E /D /Y xcopy "C:\Users\Dococ\AppData\Roaming\Microsoft\UProof\*" "W:\UProof\" /C /H /E /D /Y
If you don’t have a persistent drive mapped to your share include a create and delete statement for it.
net use w: \\server\Dococ /persistent:no net use w: /delete /y
Take a little time for the really important stuff and this is really important. If you would like to share ideas about making this script a little more fancy, please leave them in the comments and I will add them to the post.