Need an easy way to back up your files, but don’t feel like monkeying with expensive or complicated software? Using the xcopy command and a simple text file, you can accomplish this rather easily. Here’s what I do.
First, make sure that file extensions are not hidden by going to My Computer -> Tools -> Folder Options -> View. Uncheck Hide Extensions for Known File Types and click OK (if it’s already unchecked, don’t worry about it).
Now create a blank text document on your desktop. Rename it to backup.bat. Now right click on the newly created file and click Edit. Do not just double click, because that will actually run the batch file—we want to edit it for now.
The syntax for xcopy is pretty simple:
xcopy “[source location]” “[destination location]” /switch
And then there are a bunch of switches you can use. I’ll give you an entry from my batch file, and then I’ll explain what the switches all do. To copy my files from my hard disk to my USB drive, I use (follow the syntax exactly, including the quotes!):
xcopy “C:\Docs\*.*” “G:\ANDYB\Docs” /d /s /e /c /i /h /r /k /o /y /f
As you can see, wild card characters can be used to filter your backup. I just use *.* to get everything. Now, the switches:
There are other switches, like /exclude, which—surprise—allows you to exclude one or more files and/or directories. Finally, to run your batch file, simply double click it. Again, remember if you want to edit it, you right-click and choose Edit.
If you want to be really nerdy, you can have xcopy output everything to a log. I guess if you want an inventory of everything that has been backed up, this might be useful to you. Just add > [drive]:\log_file_name.txt to the end of each xcopy entry. For example:
xcopy “C:\Docs\*.*” “G:\ANDYB\Docs” /d /s /e /c > c:\backuplog.log
To append an existing log, use >> [drive]:\log_file_name.txt, like this:
xcopy “C:\Docs\*.*” “G:\ANDYB\Docs” /d /s /e /c >> c:\backuplog.log
Now if you want to get really lazy, you can set your batch file to run as a scheduled task. Most people know how to use the task scheduler in Windows, so I won’t go into that for now…unless someone demands it!
P.S. If you want, you can download xcopy here, but Win 2K and XP users should have it by default. I’m not sure if it runs under Vista or not. Try at your own risk!