创建隐藏的文件夹 [英] Creating hidden folders
本文介绍了创建隐藏的文件夹的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
有没有办法,我可以以编程方式创建任何方式(我猜的访问)的存储设备上的隐藏文件夹从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:\folders\newfolder"; // or whatever
if (!Directory.Exists(path))
{
DirectoryInfo di = Directory.CreateDirectory(path);
di.Attributes = FileAttributes.Directory | FileAttributes.Hidden;
}
这篇关于创建隐藏的文件夹的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文