制定一个文件夹,怎么样设置他的属性。比如只读,隐藏。
改变文件的有 FileSetAttr ,那文件夹的有没有呢?

解决方案 »

  1.   

    试试这个
    目录文件都可以用
    uses shellapi;
    procedure TForm1.Button1Click(Sender: TObject);
    begin
         winexec(pchar('command.com /c attrib c:\1.bmp -r'),sw_hide);
    end;
      

  2.   

    可以用FileSetAttr 函数,他对文件和文件夹一样FileSetAttr(你要设置的文件夹路径,faHidden or faReadOnly or faArchive);
    faReadOnly  只读文件
    faHidden  隐藏
    faSysFile  系统文件
    faArchive  存档
      

  3.   

    获取其属性用FileGetAttr函数
    Attrs := FileGetAttr('MyFile.sys');
      

  4.   

    cg1120 用你的方法可以,设置,但,我现在怎么改回来呢?
    FileSetAttr('文件夹路径',faReadOnly )
    怎么样设置回来呢??