One really great tool in Windows 7 (also available for Windows Vista) is the
robocopy command, which is the "robust file copy for windows" that allows you to copy an entire folder, and subfolders, from one destination into another, in a much better fashion than using
xcopy. It's perfect for quick backups into flash memory drives, hopefully encrypted with
Bitlocker to Go, first, though not necessary. The syntax, in a DOS or a
PowerShell console is
robocopy [source] [destination] /MIR
the latter, an option switch which stands for "MIRror a directory tree." In other words, you get an exact copy on the destination drive, adding or deleting folders and files, accordingly, with a complete summary at the end of the operation. Let me give you an example with a complete batch file I programmed. It will ask you first for the drive letter of the destination directory. Why this? Sometimes the drive letters of removable drives may change when other devices are added or removed. In addition, should the destination folder not exist,
robocopy will create it. Here's the batch file, in which you only have to modify the fourth line accordingly. For example's sake, your source folder is
D:\CollegePapers and the destination folder is in drive M. Once you run this batch file, you should type the corresponding drive letter, here M, and then press
Enter. Sorry, there's no error trapping included. Very useful and practical. Please, give it a try. REMINDER: if you delete directories and/or files in your source and then run this batch file, those same directories and/or files will be deleted in the destination drive. Remember: the /MIR switch is used to create a mirror, identical, copy.
Use with caution!
@echo off
set /P drLetter=Please enter drive letter:
set "thisDrive=%drLetter%:"
robocopy D:\CollegePapers %thisDrive%\CollegePapers /MIR
No comments:
Post a Comment