本文介绍了打开时删除文件夹的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
VB.NET
我想使用以下代码删除文件夹。通常它可以工作但是当测试文件夹打开时,下面的代码有一个例外。
VB.NET
i want to delete a folder using below code. Normally it works but when the testfolder is open, below code got an exception.
My.Computer.FileSystem.DeleteDirectory("testfolder", FileIO.DeleteDirectoryOption.DeleteAllContents)
有没有办法删除文件夹,即使该文件夹已打开。
我尝试过:
尝试过几个删除方法,没有人工作。
is there any way to delete the folder even when the folder is open.
What I have tried:
tried several delete method, no one worked.
推荐答案
Quote:
有什么办法可以删除文件夹,即使文件夹是打开的。
is there any way to delete the folder even when the folder is open.
不,这是防止操作系统的工作它会发生。
唯一的办法是让所有其他应用程序关闭他们在该文件夹中打开的文件。
No, it is the OS job to prevent it to happen.
The only way to do it is the have all other apps to close the files they opened in that folder.
这篇关于打开时删除文件夹的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!