创建隐藏的文件夹文件夹

由网友(神笔丶也画不出唯美的爱情)分享简介:有没有办法,我可以以编程方式创建任何方式(我猜的访问)的存储设备上的隐藏文件夹从C#?解决方案 使用System.IO;字符串路径= @C:\文件夹\ newfolder; //或任何如果(!Directory.Exists(路径)){DirectoryInfo的迪= Directory.CreateDire...

有没有办法,我可以以编程方式创建任何方式(我猜的访问)的存储设备上的隐藏文件夹从C#?

解决方案

 使用System.IO;

字符串路径= @C:文件夹 newfolder; //或任何
如果(!Directory.Exists(路径))
{
DirectoryInfo的迪= Directory.CreateDirectory(路径);
di.Attributes = FileAttributes.Directory | FileAttributes.Hidden;
}
 

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

解决方案 教你如何隐藏文件夹及文件后缀

using System.IO; 

string path = @"c:foldersnewfolder"; // or whatever 
if (!Directory.Exists(path)) 
{ 
DirectoryInfo di = Directory.CreateDirectory(path); 
di.Attributes = FileAttributes.Directory | FileAttributes.Hidden; 
}

阅读全文

相关推荐

最新文章