0

I want to build an application that will copy all new and modified files from a source folder path to a destination backup path. I know I can use a brute force loop through all files in source directory and compare in destination directory (see code below). I was just wondering if there is a script out that that will accompplish this. I am more concerned with modified files then new files.

// all files
Directory.GetFiles(txtFolderPath.Text, "*", SearchOption.AllDirectories);


// last file modified time
FileSystemInfo.LastWriteTime(filepath)
user327999
  • 443
  • 1
  • 9
  • 21
  • I agree with @elgonzo, a "script" will do the same thing you would anyway. The only way I can think of doing it so that "brute force" method isn't visible to you is to use robocopy /mir :) – Taegost Jan 15 '14 at 19:05
  • 1
    `I am more concerned with modified files then new files`, then use [FilesystemWatcher](http://msdn.microsoft.com/en-us/library/system.io.filesystemwatcher(v=vs.110).aspx) – L.B Jan 15 '14 at 19:07
  • Thanks L.B. FilesystemWatcher is exactly what I am looking for. – user327999 Jan 15 '14 at 19:40

0 Answers0