c# - Move Files That Do Not Exist -


i need copy files local hard drive external hard drive. thought is, want copy files not exist. sure there easier way such, mind went first.

my thoughts on how accomplish this:
1) list of files on c: drive , write text file
2) list of files on l: drive (backup) , write text file
3) compare c: drive text file l: drive text file find files not exist
4) write results of files not exist array
5) iterate through newly created array , copy files l: drive

is there more effective/time efficient way accomplish task?

for sure don't want create text files listing file names, , compare them. inefficient , clunky. way walk through source directories looking files. go, you'll creating matching destination path each file. before copy file need decide whether or not copy it. if file exists @ destination path, skip copying.

some enhancements on might include skipping copying if file exists , last modified date/time , file size match. , on, i'm sure can imagine variants on this.

one thing might not want build list of files first, , start copying. may more efficient copy files iterating on source directory. example use directory.enumeratefiles in efficient way.

of course, don't need write program this. thousands exist, of quite effective.


Comments

Popular posts from this blog

javascript - how to protect a flash video from refresh? -

android - Associate same looper with different threads -

visual studio 2010 - Connect to informix database windows form application -