开发者

Copy new files added to a folder to another folder in Windows

I'm looking for a way to put an event trigger on a Windows XP folder which would automatically copy a file from folder1 to folder2 when the file as created in folder1, ideally with System permissions. The purpose is to make a secure repository for file开发者_JS百科s which would be protected. I've looked at WMI, but can't figure out how to get it to trigger on the folder. Any pointers in the right direction would help. Thanks!


If you want to use WMI and need to monitor your folder all the time, you can use WMI permanent event subscription.

You would:

  • Create a WMI filter ( a query like this, for example: "Select * From __InstanceCreationEvent Within 5 Where TargetInstance Isa 'Cim_DataFile' And TargetInstance.Drive = 'C:' and TargetInstance.Path = '\folder\subfolder\'")

  • Create a WMI event consumer (a batch or VBScript file to copy the created file to your new location)

  • Bind the two together

This way you would ensure that the folder is monitored 'at all times' (as long as WMI service is running). You can use VBScript, PowerShell, C# or MOF to set this up. (See the Script Center blog for details)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜