我需要将所有文件从源文件夹移动到目标文件夹。我怎样才能轻松从文件路径名中提取文件名?如何从文件路径名中提取文件名?
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);
}
谢谢,我喜欢这个网站))1分钟得到答案。 – 2010-10-21 10:38:23
不客气。无论如何没有更好的办法(你知道:工作)。 – 2010-10-21 10:39:57
很多人看到你的问题:),集体智慧 – TalentTuner 2010-10-21 10:40:27