gpt4 book ai didi

c# - 如何将所有* .bak文件从目录A复制到目录B?

转载 作者:太空宇宙 更新时间:2023-11-03 17:34:51 25 4
gpt4 key购买 nike

如何将所有*.bak文件从Directory A复制到Directory B

最佳答案

这应该可以满足您的需求:

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);
}
}

关于c# - 如何将所有* .bak文件从目录A复制到目录B?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5198802/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com