【发布时间】:2016-07-28 19:15:05
【问题描述】:
复制到另一个文件夹后如何删除 zip 文件...我在删除时遇到异常...它说“该文件正在被另一个进程使用”。
string pathString1 = FullFilePath;
string sourceFileName = Path.GetFileName(pathString1);
string foldername = Path.GetDirectoryName(pathString1);
string pathString = Path.Combine(foldername, "Uploaded");
if (!System.IO.Directory.Exists(pathString))
{
System.IO.Directory.CreateDirectory(pathString);
string destFile = System.IO.Path.Combine(pathString, sourceFileName);
File.Copy(pathString1, destFile);
File.Delete(pathString1);
File.Delete(FileName);
}
【问题讨论】:
-
提供您用于处理文件的代码。
-
显示您尝试获取帮助的代码。
-
您需要关闭用于读取文件的流。一旦我们看到您的代码,我们就可以提供帮助。
-
我已经编辑了我的问题
-
代码中的大括号在哪里?只有一个孤独的人