Synchronising files

  • Thread starter Thread starter JezB
  • Start date Start date
J

JezB

I want to synchronise files between directories as part of my .NET
application. Ideally I'd like to invoke an XCOPY-like operation which copies
only new and changed files from source to target. Is anything like this
available as part of the framework ? If not how do I invoke a windows
command from within a .NET application and capture the output ?
 
I want to synchronise files between directories as part of my .NET
application. Ideally I'd like to invoke an XCOPY-like operation which copies
only new and changed files from source to target. Is anything like this
available as part of the framework ? If not how do I invoke a windows
command from within a .NET application and capture the output ?

I would recommend a windows service to monitor changes in the directory and for
instance File.Copy to copy the files.

If you want to fire xcopy from within your program you can use the Process and
ProcessStartInfo (and perhaps ProcessInfo) classes. They will also let you
specify your own input, output, and error output.
 
You can use the FileSystemWatcher .Net framework component to monitor a
folder for changes and then use the classes in System.IO to sync the two
folders
 
Back
Top