【发布时间】:2024-05-22 22:50:02
【问题描述】:
我需要将所有文件从源文件夹移动到目标文件夹。如何轻松从文件路径名中提取文件名?
string newPath = "C:\\NewPath";
string[] filePaths = Directory.GetFiles(_configSection.ImportFilePath);
foreach (string filePath in filePaths)
{
// extract file name and add new path
File.Delete(filePath);
}
【问题讨论】: