另一个进程正在使用此文件,因此该进程无法访问此文件。
请问如何解决?
代码:
bool success;
try
{
success = SendMail(FromMail, mailname, mailpassword, ToMail, smtphost, port, Subject + System.DateTime.Now.ToShortDateString() + fileNames[index].Name, body, fileNames[index].FullName, ccadd, bccadd);
}
catch
{
success = false;
}
if (success)
{
textLog.Text = textLog.Text + "\r\n" + "【" + System.DateTime.Now + "】【成功】" + fileNames[index].FullName;
System.IO.File.AppendAllText(@logName, "【" + System.DateTime.Now + "】【成功】" + fileNames[index].FullName + "\r\n");
if (!Directory.Exists(Attachmentsfile + "\\Bakup"))//判断是否存在
{
Directory.CreateDirectory(Attachmentsfile + "\\Bakup");//创建新路径
}
fileNames[index].Refresh();
System.IO.File.Move(fileNames[index].FullName, Attachmentsfile + "\\Bakup\\" + fileNames[index].Name);
}
else
{
textLog.Text = textLog.Text + "\r\n" + "【" + System.DateTime.Now + "】【失败】" + fileNames[index].FullName;
System.IO.File.AppendAllText(@logName, "【" + System.DateTime.Now + "】【失败】" + fileNames[index].FullName + "\r\n");
}
相关推荐
IIS “另一个程序正在使用此文件,进程无法访问。”错误提示的解决办法
如何查看哪个程序打开了tcp 80端口呢?使用“开放端口查看软件Active ports”就可以一目了然了。我查看了一下我的机器情况,如图所示: 从图上看出原来Skype打开了Tcp 80端口,原来是这个家伙惹的祸,将其关闭。再重启IIS,一切正常。 如果在IIS启动之后再开Skype,Skype仍能正常使用。说明Skype发现tcp 80端口已打开就不再使用此端口了。看来启动IIS还得有个顺序,那就是先启动IIS再启动Skype。 补充:其实Skype可以通过设置不让其打开80端口的。这样就不用考虑启动顺序的问题了。具体操作是:Skype 菜单”工具”->”选项”->”连接” 项,
pip install 另一个程序正在使用此文件,进程无法访问
pip install 另一个程序正在使用此文件,进程无法访问 Running setup.py clean for SQLAlchemy Failed to build SQLAlchemy Installing collected packages: SQLAlchemy, flask-sqlalchemy Running setup.py install for SQLA...
Delphi无法运行,提示EditorLineEnds.ttr另一个程序正在使用此文件,进程无法访问
由于微软补丁KB2982791, KB2970228的缘故,导致Delphi8-DelphiXE在不重起系统的情况下无法被重启两次!提示%TEMP%\EditorLineEnds.ttr另一个程序正在使用此文件,进程无法访问.工具为包括所有版本的修复补丁,请根据需要的版本执行补丁!Delphi2007分WIN8版和其它版的支持
Delphi无法运行,提示EditorLineEnds.ttr另一个程序正在使用此文件,进程无法访问 for RAD Studio 10.1 Berlin
解决delphi RAD Studio 10.1 Berlin 运行提示“Cannot create file C:\Users\Admin\AppData\Local\Temp\EditorLineEnds.ttr” 版本: IDE Fix Pack for RAD Studio 10.1 Berlin - Version 5.96 (2017-04-09)
Delphi无法运行,提示EditorLineEnds.ttr另一个程序正在使用此文件,进程无法访问 RAD Studio 10 Seattle
解决delphi RAD Studio 10 Seattle 运行提示“Cannot create file C:\Users\Admin\AppData\Local\Temp\EditorLineEnds.ttr” 版本: IDE Fix Pack for RAD Studio 10 Seattle - Version 5.96 (2017-04-09)


