procedure DelFiles(fileName: string);
var
SearchRec: TSearchRec;
begin
ChDir(ExtractFilePath(fileName)); //进入文件路径
FindFirst(fileName, faAnyFile, SearchRec);
repeat
if FileExists(SearchRec.Name) then
begin
//FileSetAttr(SearchRec.Name,0); //修改文件属性为普通属性值
DeleteFile(SearchRec.Name); //删除文件
end;
until(FindNext(SearchRec)<>0);
FindClose(SearchRec);
end;
var
SearchRec: TSearchRec;
begin
ChDir(ExtractFilePath(fileName)); //进入文件路径
FindFirst(fileName, faAnyFile, SearchRec);
repeat
if FileExists(SearchRec.Name) then
begin
//FileSetAttr(SearchRec.Name,0); //修改文件属性为普通属性值
DeleteFile(SearchRec.Name); //删除文件
end;
until(FindNext(SearchRec)<>0);
FindClose(SearchRec);
end;