|
The goal is: when a given USB key isplugged into the computer, synchronize all files in a given folder on the key(e.g. D:\SyncFolder) with an analog folder on the local hard drive (say C:\Users\Me\SyncFolder).
Requirements:
- Windows 7 (with Task Scheduler and Event Viewer installed)
- SyncToy 2.1 (free software from Microsoft)
First, download SyncToy using thelink above. Plug your drive in and establish a folder pairing between your twofolders, in our example D:\SyncFolder and C:\Users\Me\SyncFolder (for more information, check out this tutorialon folderpairing with SyncToy).
Next, create an event using the TaskScheduler, which is installed by default on Windows 7 (you’ll find itin Start Menu → Accessories → System Tools).
- In the Triggers tab, create a new “On Event” trigger. The USB insertion event is a little hard to find: on my system, it was located in Event Viewer/Applications and Services Logs/Microsoft/Windows/DriverFrameworks-UserMode/Operational. Plug our key in and out once or twice and spot the new events in the log; note the ID of the last one (make sure the description has something to do with the particular USB drive you inserted) and report it in the Task Scheduler.
- [GW comment:] The above bullet point is not clear. The best way is to use event viewer and find the event using the above method. Then RIGHT CLICK the event and chose build task against this event....
- In the Action tab, create a new “Start Program” action. In the Start a Program window, browse to SyncToyCmd.exe (in SyncToy’s install folder). The argument should be "-R PairName" (where “PairName” is, guess, the name you gave to the pairing in SyncToy). Beware, the command line is case sensitive.
Note that this approach has multiplelimitations: if the drive letter for you key changes, you’ll have to configurethe pairing again, and software re-plugs of USB drives tend to occur quitefrequently (every 5 min on my machine). The plus side of this behavior is thatyour files are synced as well, but it turns into a minus side if you are usinga (battery-powered) laptop. In the latter case, you can check the “Start thetask only if the computer is on AC power” option in the Conditions tabof your event.
This is the best solution I’ve foundfor now (given that, for good reasons, autorun.inf filesdon’t work any more). Most of the help came from this question on superuser.com. |
|