tags:

views:

62

answers:

3

I have two folders on the same machine - "Folder 1" & "Folder 2". Anytime I add/remove/modify a folder/file within Folder 1, it should sync with "Folder 2" immediately. I found a similar article over at Code Project (http://www.codeproject.com/KB/files/FileSync.aspx) but for some reason it doesn't sync and there are no errors.

Any pointers?

A: 

If you want to see another example, check this one, I haven't tried it, just recommending by looking at the name of the post. (I'm not sure if you can see the page without logging in. signing up is pretty easy and free btw)

davsan
Yes, I'm able to see it but can it be automated?
If you find out that your example's file watcher part is OK but synchronization part is not working, then you can mix these two.
davsan
A: 

FileSystemWatcher has a property "EnableRaisingEvents" which is set to false for all but the first instance of FSW created inside a thread. May I recommend to enforce setting this value to true manually for each instance?

Jas
Are you talking about the FileSync article at Code Project? Change the source code and re-compile it?
I am saying if you are creating the FSW objects yourself in a thread, check to set this property. The code in the article seems to set this properly, my assumption was that you had your own code doing the same, minus manually setting the property.
Jas
A: 

Try having a look at the Microsoft Sync Framework. One of the samples involves syncing files between directories.

You can use a FileSystemWatcher to trigger the sync process.

Matthew Steeples