How to Synchronize a Folder With a Flash Drive in Vista

How to Synchronize a Folder With a Flash Drive in Vista thumbnail
How to Synchronize a Folder With a Flash Drive in Vista

Many backup programs exist for Windows Vista, but the majority of these programs must be purchased, and you may not be inclined to spend money if your only desire is to synchronize a folder on your computer with a flash drive. However, it is possible to construct a simple solution for backing up a folder using tools already built in to Windows. Construct a batch script to have Windows Vista copy the contents of a folder to a flash drive when the drive is inserted.

Instructions

  1. Preparation

    • 1

      Insert a flash drive into your computer. Click "Start," then click "Computer." Double-click the flash drive to open the contents window.

    • 2

      Click the "Organize" button at the top of the window, then click "Folder and Search Options."

    • 3

      Click the "View" tab. Remove the check from the box labeled "Hide extensions for known file types," and click "OK."

    • 4

      Right-click in an open area of the window, and click "New" and "Folder." Name the folder "backup" and press "Enter."

    • 5

      Right-click in the window, and click "New" and "Text Document." Name the file "autorun.inf." Note that you will need to highlight the ".txt" at the end of the document and delete it in order to give the file the "inf" extension. When Windows displays a warning about the file being potentially unreadable, click "Yes."

    • 6

      Right-click in the window again, and click "New" and "Text Document." Name the second file "sync.bat."

    Creating the Backup Script

    • 7

      Right-click "autorun.inf" and click "Open." This opens the file in Notepad.

    • 8

      Type "[autorun]" in the first line of the text document and press "Enter." Do not include the quotation marks in this or any other step.

    • 9

      Type "shell\copy=Sync Folder with Flash Drive" in the second line and press "Enter."

    • 10

      Type "shell\copy\command=sync.bat" in the third line and press "Enter."

    • 11

      Type "shell=copy" in the fourth line. Click "File" and "Save," then close Notepad. The file that you have created will cause a new command labeled "Sync Folder with Flash Drive" to be displayed the next time the flash drive is inserted in the computer. When the command is clicked, Windows will execute the file "sync.bat."

    • 12

      Right-click "sync.bat" and click "Edit." The file opens in Notepad.

    • 13

      Type "xcopy c:\folder f:\backup /s /v /w /y" in the first line of the Notepad window. Where "c:\folder" is given in the example, you must substitute the full path of the folder that you want to synchronize. Also note that the "f:" given in the example must be changed if your flash drive has a different letter assignment. See "Tips" for a full explanation.

    • 14

      Click "File" and "Save," then close Notepad.

    • 15

      Click the "Back" button at the top of the window to return to the "Computer" window.

    • 16

      Remove the flash drive from your computer and re-insert it.

    • 17

      Right-click the flash drive icon, then click "Sync Folder with Flash Drive." Alternatively, you may simply double-click the icon. Windows will run the "sync.bat" file that you created. If you left the "/w" trigger given in the example, a DOS window will open, asking you to press a key to begin copying the files. Press a key. The folder that you have chosen to synchronize, and all of its contents, will be copied to the flash drive.

Tips & Warnings

  • XCOPY is a powerful DOS command with many special features. The "/s" trigger given in the example copies all of the contents in the folder that you are synchronizing, as well as any files stored in folders within that folder. The "/v" trigger verifies each copied file after the operation is complete to confirm that the copies match the original files. The "/w" trigger prompts you before the operation begins so you can confirm that you want to synchronize the folders. The "/y" trigger tells XCOPY to always overwrite the files on the flash drive if they have the same name as the files in the folder that you are synchronizing. Any of these triggers may be left out if you wish.

  • If you are accustomed to double clicking the icon for your flash drive in the "Computer" window to browse the contents of the flash drive, note that after following the instructions in this article, double clicking the icon will now launch the batch script you have created. To browse the contents of the flash drive, right click the icon and click "Explore."

  • To remove the synchronization script that you have created, delete "autorun.inf" and "sync.bat" from your flash drive. The backup folder will remain unless you manually delete it.

Related Searches:

References

  • Photo Credit Visage/Stockbyte/Getty Images

Comments

You May Also Like

Related Ads

Featured