怎么样改变文件夹的属性?

sunboy2002 2003-01-13 12:44:38
我从光盘上拷贝了文件夹到本地硬盘,所以文件夹的属性是只读的,现在要将只读属性去掉(当然它里面的所有子文件夹和文件的只读属性都要去掉)。
...全文
30 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
gaga_ghost 2003-01-13
  • 打赏
  • 举报
回复
右键属性,去掉只读,系统会提示你的。
sunboy2002 2003-01-13
  • 打赏
  • 举报
回复
ok,搞定了!
zswangII 2003-01-13
  • 打赏
  • 举报
回复
procedure AttribPath(mDirName: string; mAttrib: Integer);
var
vSearchRec: TSearchRec;
vPathName: string;
K: Integer;
begin
vPathName := mDirName + '\*.*';
K := FindFirst(vPathName, faAnyFile, vSearchRec);
while K = 0 do begin
if Pos(vSearchRec.Name, '..') = 0 then
AttribPath(mDirName + '\' + vSearchRec.Name, mAttrib);
K := FindNext(vSearchRec);
end;
FileSetAttr(mDirName, mAttrib);
FindClose(vSearchRec);
end; { AttribPath }

procedure TForm1.Button1Click(Sender: TObject);
begin
AttribPath('c:\temp', 0);
end;

//忘了做递归 :( 修正一下~~嘿嘿~~
zswangII 2003-01-13
  • 打赏
  • 举报
回复
procedure AttribPath(mDirName: string; mAttrib: Integer);
var
vSearchRec: TSearchRec;
vPathName: string;
K: Integer;
begin
vPathName := mDirName + '\*.*';
K := FindFirst(vPathName, faAnyFile, vSearchRec);
while K = 0 do begin
if (vSearchRec.Attr and faDirectory > 0) and
(Pos(vSearchRec.Name, '..') = 0) then
FileSetAttr(mDirName + '\' + vSearchRec.Name, faDirectory or mAttrib)
else if Pos(vSearchRec.Name, '..') = 0 then
FileSetAttr(mDirName + '\' + vSearchRec.Name, mAttrib);
K := FindNext(vSearchRec);
end;
FileSetAttr(mDirName, faDirectory or mAttrib);
FindClose(vSearchRec);
end; { AttribPath }

procedure TForm1.Button1Click(Sender: TObject);
begin
AttribPath('c:\temp', 0);
end;

嘻嘻嘻 随便灌水、随便给分 嘻嘻嘻嘻
sunboy2002 2003-01-13
  • 打赏
  • 举报
回复
废话,当然是在delphi中用程序实现!

1,183

社区成员

发帖
与我相关
我的任务
社区描述
Delphi Windows SDK/API
社区管理员
  • Windows SDK/API社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧