四海人民公摄 - 海外华人摄影爱好者论坛

 找回密码
 注册
搜索
热搜: 活动 交友 discuz
查看: 1212|回复: 0

Automatic File Sync from USB Key on Windows 7

[复制链接]
发表于 2012-4-13 18:20:10 | 显示全部楼层 |阅读模式
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.
您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|手机版|Archiver|四海人民公摄 - 海外华人摄影爱好者网站

GMT+8, 2024-11-22 01:23

Powered by Discuz! X3.5

Copyright © 2001-2023 Tencent Cloud.

快速回复 返回顶部 返回列表