y一个对文件操作的小问题(100分)

  • 主题发起人 主题发起人 nowisay
  • 开始时间 开始时间
N

nowisay

Unregistered / Unconfirmed
GUEST, unregistred user!
我想对文件夹下的几个未知名文件进行操作,如copy,不知有什么好的办法,谢谢拉。。。。。。。。。
。。。。。请伸出你那温暖的手。
 
用FindFirst, FindNext,可以查找改目录下的所有文件
 
copyfile(pchar(application.Exename), pchar(路径名及路径), False
 
我也想知道。
 
//查找指定扩展名文件的例子,希望对你有帮助。
//具体参数:mainpath,路径;fileextern:扩展名;filename:获得的文件列表;
procedure SearchFile(mainpath,FileExtern:string;var FileName:TStringList);

procedure SearchFile(Mainpath,FileExtern:string;var FileName:TStringList);
var
Status: Integer;
SearchRec: TSearchRec;
function SlashSep(const Path, S: string): string;
begin
if AnsiLastChar(Path)^ <> '/' then
Result := Path + '/' + S
else
Result := Path + S;
end;
begin
Status:= FindFirst(SlashSep(Mainpath,FileExtern),faAnyFile,SearchRec);
while Status=0 do
begin
FileName.Add(SearchRec.Name);
Status:=FindNext(SearchRec);
end;
FindClose(SearchRec);
end;
 
是不是想对目录操作啊
用FindFirst, FindNext, FindClose
 
谢谢各位!!
 
多人接受答案了。
 
后退
顶部