求:怎样DELETE指定文件夹? 请问用怎样的方法删除电脑里指定的文件夹? 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 System.IO.Directory.Delete System.IO.DirectoryInfo.Delete 如果是删除文件夹里的内容呢?System.IO.Directory.Delete 删除的好像是文件夹,对吧?它能用来删文件夹里的内容吗?请指教~~~~ System.IO.Directory.Delete("you dir")System.IO.Directory.CreateDirectory("you dir")如果想保留目录,那删除后再创建个同名的空目录就行了 System.IO.Directory.Delete("you dir")System.IO.Directory.CreateDirectory("you dir")如果想保留目录,那删除后再创建个同名的空目录就行了我现在要删除的是系统文件夹里的内容~系统文件夹不让删除的~~~ System.IO.Directory.Delete("you dir",true);这样可以把文件夹和文件夹内容全部删掉。删掉后你再建一个同名的文件夹就可以了。 DirectoryInfo di = new DirectoryInfo(@"c:\aaa");//指定文件夹 FileSystemInfo[] dirs = di.GetFileSystemInfos(); foreach (FileSystemInfo a in dirs) { if(System.IO.Directory.Exists(a.FullName)) { System.IO.Directory.Delete(a.FullName,true); } else{ System.IO.File.Delete(a.FullName); } } 通过输入指定的文件夹删除:if(!Directory.Exists(tbx_input.text)){ lbl_message.text="文件夹不存在!";}else{ Directory.Delete(tbx_input.text) lbl_message.text="文件夹删除成功!";}在tbx_input里输入f:\110 就删除110文件夹了 图表区没人,特来求VS 05的rdlc报表制作教程 请教:C#windows服务通过CMD启动程序的释放问题 .net做的小程序别人是不是必须装完整的.NET3.5 遇到一奇怪问题。求解释。 做共享软件开始用什么语言比较好. 【求助】如何让TreeView的水平滚动条正确显示? null和System.DBNull.Value的区别 ?? 共享\只读问题? WF中关于自动数据重发的问题 新手问题第七贴--------如果进行 hash 排序和检索,可以给200 一个跳转问题 谁告诉我一下 一个关于StreamReader使用后资源不能释放的问题!——请高手帮我指点一下。
System.IO.DirectoryInfo.Delete
删除的好像是文件夹,对吧?它能用来删文件夹里的内容吗?
请指教~~~~
System.IO.Directory.CreateDirectory("you dir")
如果想保留目录,那删除后再创建个同名的空目录就行了
System.IO.Directory.CreateDirectory("you dir")
如果想保留目录,那删除后再创建个同名的空目录就行了我现在要删除的是系统文件夹里的内容~
系统文件夹不让删除的~~~
这样可以把文件夹和文件夹内容全部删掉。删掉后你再建一个同名的文件夹就可以了。
FileSystemInfo[] dirs = di.GetFileSystemInfos();
foreach (FileSystemInfo a in dirs)
{
if(System.IO.Directory.Exists(a.FullName))
{
System.IO.Directory.Delete(a.FullName,true);
}
else{
System.IO.File.Delete(a.FullName);
} }
if(!Directory.Exists(tbx_input.text))
{
lbl_message.text="文件夹不存在!";
}
else
{
Directory.Delete(tbx_input.text)
lbl_message.text="文件夹删除成功!";
}
在tbx_input里输入f:\110 就删除110文件夹了