请问用怎样的方法删除电脑里指定的文件夹?

解决方案 »

  1.   

    System.IO.Directory.Delete 
    System.IO.DirectoryInfo.Delete 
      

  2.   

    如果是删除文件夹里的内容呢?System.IO.Directory.Delete 
    删除的好像是文件夹,对吧?它能用来删文件夹里的内容吗?
    请指教~~~~
      

  3.   

    System.IO.Directory.Delete("you dir")
    System.IO.Directory.CreateDirectory("you dir")
    如果想保留目录,那删除后再创建个同名的空目录就行了
      

  4.   

    System.IO.Directory.Delete("you dir")
    System.IO.Directory.CreateDirectory("you dir")
    如果想保留目录,那删除后再创建个同名的空目录就行了我现在要删除的是系统文件夹里的内容~
    系统文件夹不让删除的~~~
      

  5.   

    System.IO.Directory.Delete("you dir",true);
    这样可以把文件夹和文件夹内容全部删掉。删掉后你再建一个同名的文件夹就可以了。
      

  6.   

    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);
    } }
      

  7.   

    通过输入指定的文件夹删除:
    if(!Directory.Exists(tbx_input.text))
    {
      lbl_message.text="文件夹不存在!";
    }
    else
    {
      Directory.Delete(tbx_input.text)
      lbl_message.text="文件夹删除成功!";
    }
    在tbx_input里输入f:\110 就删除110文件夹了