• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 219
  • Last Modified:

Best way to synchronize 2 folders

Hi experts

i have to make a program that synchronize 2 folders
but i'm asking if there is a smart way to do this because the only way i know if to loop throught all files in one folder and check if exist in the other
but when the program crash in the middle thread, i have to loop from the beginning, that's not very handy...

so i'm sure there is a way to make this smartly...

please let me know how you will do this if you have to sync 2 folders smartly

any suggestion are welcome...

regards

0
Dnx_7
Asked:
Dnx_7
2 Solutions
 
ericwong27Commented:
Hi,

If the coding is not the "must-do" then try to use SyncToy v1.4 (Freeware from Microsoft)

http://www.microsoft.com/downloads/details.aspx?familyid=E0FC1154-C975-4814-9649-CCE41AF06EB7&displaylang=en
0
 
DEEPESHCommented:
I don't know what you have code but if i have to do it i would do it in this manner
You can use FileSystemWatcher and whenever changes take palce in the folder, start copying,
Second check each file through io.File.Exists on destination path, if not then use io.file.copy

Visit the links it may help
http://vbnet.mvps.org/index.html?code/fileapi/copyfile.htm
http://dotnetjunkies.com/Forums/ShowPost.aspx?PostID=1547

I think what you are doing is correct
0
 
Dnx_7Author Commented:
thank you guys...
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now