c# - how to copy all *.bak files from Directory A to Directory B? -
how copy *.bak
files directory a
directory b
?
this should need:
string dira = @"c:\"; string dirb = @"d:\"; string[] files = system.io.directory.getfiles(dira); foreach (string s in files) { if (system.io.path.getextension(s).equals("bak")) { system.io.file.copy(s, system.io.path.combine(targetpath, filename), true); } }
Comments
Post a Comment