您的位置:程序门 -> web 开发 -> asp



如何去掉文件属性


[收藏此页] [打印本页]选择字色:背景色:字体:[][][]


如何去掉文件属性
发表于:2007-04-16 15:33:30 楼主
如果我只读文件更改为可以写入内容
发表于:2007-04-16 15:43:191楼 得分:0
asp没有这个功能,自己写个组件吧
发表于:2007-04-16 15:53:232楼 得分:0
参考fso的attributes属性:
设置或返回文件或文件夹的属性。根据不同属性为读/写或只读。

object.attributes   [=   newattributes]
参数
object  
必选项。应为   file   或   folder   对象的名称。  
newattributes  
可选项。如果提供了这个部分,那么   newattributes   将成为指定的   object   的新属性值。  
设置
newattributes   参数可以是下列各值或者这些值的任意逻辑组合:

常数   值   描述  
normal   0   普通文件。不设置属性。  
readonly   1   只读文件。属性为读/写。  
hidden   2   隐藏文件。属性为读/写。  
system   4   系统文件。属性为读/写。  
volume   8   磁盘驱动器卷标。属性为只读。  
directory   16   文件夹或目录。属性为只读。  
archive   32   文件在上次备份后已经修改。属性为读/写。  
alias   64   链接或者快捷方式。属性为只读。  
compressed   128   压缩文件。属性为只读。  

说明
下面的代码通过一个文件说明了   attributes   属性的用法:

[jscript]
function   togglearchivebit(filespec)
{
      var   fso,   f,   r,   s;
      fso   =   new   activexobject( "scripting.filesystemobject ");
      f   =   fso.getfile(filespec)
      if   (f.attributes   &&   32)
      {
            f.attributes   =   f.attributes   -   32;
            s   =   "archive   bit   is   cleared. ";
      }
      else
      {
            f.attributes   =   f.attributes   +   32;
            s   =       "archive   bit   is   set. ";
      }
      return(s);
}
[vbscript]
function   togglearchivebit(filespec)
      dim   fso,   f
      set   fso   =   createobject( "scripting.filesystemobject ")
      set   f   =   fso.getfile(filespec)
      if   f.attributes   and   32   then
            f.attributes   =   f.attributes   -   32
            togglearchivebit   =   "archive   bit   is   cleared. "
      else
            f.attributes   =   f.attributes   +   32
            togglearchivebit   =   "archive   bit   is   set. "
      end   if
end   function


快速检索

最新资讯
热门点击