C# Deleting Directories

后端 未结 3 2044
走了就别回头了
走了就别回头了 2021-01-26 12:28

I\'m working with the .NET Compact Framework 3.5 and want to delete some specific folders and their subfolders. When I run the app it gives IO exception. I\'ve tried to use Dire

相关标签:
3条回答
  • 2021-01-26 13:01

    You are not telling what kind of IO exception you are getting, Are you missing a backslash () in your path?

    mainPath + "CRM" becomes "\Storage Card\denemeCRM" and not "\Storage Card\deneme\CRM"
    
    0 讨论(0)
  • 2021-01-26 13:03

    Try this..

    var dir = new DirectoryInfo(@FolderPath);
    dir.Delete(true);
    
    0 讨论(0)
  • 2021-01-26 13:11

    Why not delete the directory recursively:

    Directory.Delete(path, true);
    

    See here.

    Also, see here as it may be similar to what you are encountering.

    0 讨论(0)
提交回复
热议问题