Creating hidden folders

前端 未结 5 1062
-上瘾入骨i
-上瘾入骨i 2020-12-13 17:52

Is there any way that I can programmatically create (and I guess access) hidden folders on a storage device from within c#?

5条回答
  •  借酒劲吻你
    2020-12-13 17:53

    using System.IO; 
    
    string path = @"c:\folders\newfolder"; // or whatever 
    if (!Directory.Exists(path)) 
    { 
    DirectoryInfo di = Directory.CreateDirectory(path); 
    di.Attributes = FileAttributes.Directory | FileAttributes.Hidden; 
    }
    

提交回复
热议问题