arrays - copying files from one folder to another only if their file name is a in a specified text file c# -
i need copy files 1 folder if file name in text file. text file set so
file1.jpg file2.jpg file3.jpg etc
there around one-million files copy. i'm using c#.
what best way go be? i'm not sure if should first read file names text file , put them in list possibly convert list in array maybe use array somehow? or maybe there's better way go it?
i know how read , write files , how copy 1 source destination another. don't know how filter out specific files when copying 1 source destination though.
any appreciated.
thank you.
the following code process want
string source = @"c:\sourcepath\"; string destination = @"c:\destinationpath\"; string[] strfiles = file.readalltext(@"c:\filename.txt").split(' '); (int = 0; < strfiles.length; i++) { file.copy(source + strfiles[i], destination + strfiles[i]); }
Comments
Post a Comment