关于修改文件属性的问题,高人请进 本帖最后由 lxcnn 于 2009-10-27 08:35:26 编辑 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 设置文件属性string filePath = @"d:\file"; DirectoryInfo dir = new DirectoryInfo(filePath); FileInfo[] fileInfo = dir.GetFiles(); foreach (FileInfo file in fileInfo) { string fileName = file.FullName; File.SetAttributes(fileName,FileAttributes.Hidden); } }File.SetAttributes("",FileAttributes.ReadOnly);//只读属性 FileAttributes MyAttributes = File.GetAttributes(""); File.SetAttributes(textBox1.Text, FileAttributes.Normal);//设置文件夹属性为正常 File.SetAttributes("", FileAttributes.ReadOnly);//设置只读文件夹File.SetAttributes(textBox1.Text, MyAttributes | FileAttributes.System);//设置添加系统文件夹 File.SetAttributes(textBox1.Text, MyAttributes | FileAttributes.Hidden);//设置添加隐藏文件夹 File.SetAttributes("", MyAttributes | FileAttributes.Archive);//设置添加归档文件夹 是项目里面的吧exe文件 AssemblyInfo.cs这个文件里面可以改 防止WORD文档属性暴露信息 可以直接在文档中打开“工具”菜单下的“选项”命令,然后在“安全性”标签中把“隐私选项”下的“保存时从文件属性中删除个人信息”项选中即可。 以上方法可以用COM方式代码实现。 摘要信息不是每种文件都有的。 邮件--->文件-->概要概要信息是每种文件都有的,并不只是office文档,不信你们看看就知道了。 概要信息是每种文件都有的,并不只是office文档,不信你们看看就知道了。前提是NTFS格式的文件系统 楼主,看看你NTFS文件系统下的 *.xml 文件有不,我的系统是没有概要信息。 (1)文件的概要信息的保存位置:在文件中(2)禁止修改概要信息的方法File.SetAttributes(@"c:\prg1.cs", FileAttributes.ReadOnly); //只读不能修改(3)不是所有文件类型,支持概要信息。 xml,用于信息交流的标准文件格式,不允许乱写信息 有关NT文件系统结构的文章中,有详细的分析。 概要信息在属性信息记录中给你个参考资料:NTFS文件系统若干技术研究 头文件里面应该有什么作者之类的信息。。比如ultredit工具看得到随便说的 不是高人,谈一下我的个人见解。2楼说的是file attributes,不是楼主说的summary properties. 这是由区别的,file attributes可以通过FileAttributes 和 File类访问和设置,楼主说的summary properties可以通过IPropertySetStorage和IPropertyStorage接口访问和设置。在NTFS文件系统中,任何类型的文件都可以设置summary properties,对于Office文档(compound files) ,summary properties是文档本身的一部分,和文件系统无关,其它类型文件则不同。楼主说的设置summary properties可以实现的,只要满足如下条件,文件是compound file或者文件系统是NTFS格式的,但要设置成只读的似乎办不到。 if (File.GetAttributes("D:\aa.xls") != FileAttributes.ReadOnly) { File.SetAttributes(strfrom, FileAttributes.ReadOnly); } 菜鸟求教:如何看到vs中c#系统自带的库的具体实现 C#代码是什么意思 求教C#数组的key Backspace代码实现 c# 中求50到100之间哪个数具有最多真因子 APS.NET(VS2003)开发的WebForm程序过程中的内存管理问题 asp.net中怎么判断SQL语句已执行成功? 资源方面的问题 propertyGrid控件用法中如何出现像C#中的“小闪电”图标? post请求,request接收 中文乱码问题 关于线程的问题? 新手跪求,怎样才能Deserialize一个xml文件?
string filePath = @"d:\file";
DirectoryInfo dir = new DirectoryInfo(filePath);
FileInfo[] fileInfo = dir.GetFiles();
foreach (FileInfo file in fileInfo)
{
string fileName = file.FullName;
File.SetAttributes(fileName,FileAttributes.Hidden);
}
}
File.SetAttributes("",FileAttributes.ReadOnly);//只读属性
FileAttributes MyAttributes = File.GetAttributes("");
File.SetAttributes(textBox1.Text, FileAttributes.Normal);//设置文件夹属性为正常
File.SetAttributes("", FileAttributes.ReadOnly);//设置只读文件夹
File.SetAttributes(textBox1.Text, MyAttributes | FileAttributes.System);//设置添加系统文件夹
File.SetAttributes(textBox1.Text, MyAttributes | FileAttributes.Hidden);//设置添加隐藏文件夹
File.SetAttributes("", MyAttributes | FileAttributes.Archive);//设置添加归档文件夹
可以直接在文档中打开“工具”菜单下的“选项”命令,然后在“安全性”标签中把“隐私选项”下的“保存时从文件属性中删除个人信息”项选中即可。
以上方法可以用COM方式代码实现。
摘要信息不是每种文件都有的。
概要信息是每种文件都有的,并不只是office文档,不信你们看看就知道了。
前提是NTFS格式的文件系统
楼主,看看你NTFS文件系统下的 *.xml 文件有不,我的系统是没有概要信息。
(2)禁止修改概要信息的方法File.SetAttributes(@"c:\prg1.cs", FileAttributes.ReadOnly); //只读不能修改(3)不是所有文件类型,支持概要信息。 xml,用于信息交流的标准文件格式,不允许乱写信息
NTFS文件系统若干技术研究
随便说的
{
File.SetAttributes(strfrom, FileAttributes.ReadOnly);
}