本文介绍了FileInfo.Delete无法删除文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当使用FileInfo删除文件时,该文件仍保留在目录中(不是

已删除)


Dim foo为New FileInfo(strFileToDelete)

尝试

foo.Delete()

Catch ex as IOException

''打开文件处理程序

End Catch


该文件存在且有效。路径存在且有效。没有文件

属性被设置,但ARCHIVE除外。我有权读取和写入
到目录。

没有抛出异常(ex = Nothing)但是文件没有从
$ b中删除$ b目录。

有什么建议吗?

提前致谢。

Allen

When using FileInfo to delete a file, the file remains in the directory (not
deleted)

Dim foo as New FileInfo(strFileToDelete)
Try
foo.Delete()
Catch ex as IOException
''Open file handler
End Catch

The file exists and is valid. The path exists and is valid. No file
attributes are set except for ARCHIVE. I have permission to read and write
to the directory.
No exception is thrown (ex = Nothing) yet the file is not deleted from the
directory.
Any suggestions?
Thanks in advance.
Allen

推荐答案






如果使用''System.IO.File.Delete(< filename>)''它是否有用?


-

Herfried K. Wagner [MVP]

< http://www.mvps.org/dotnet>



Does it work if you use ''System.IO.File.Delete(<filename>)''?

--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>




如果使用''System.IO.File.Delete(< filename>)''它是否有效?



Does it work if you use ''System.IO.File.Delete(<filename>)''?




问候 - OHM#OneHandedMan { at} BTInternet {dot} com



Regards - OHM# OneHandedMan{at}BTInternet{dot}com


这篇关于FileInfo.Delete无法删除文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-04 05:23
查看更多