procedure TForm1.DelFiles(FilePath:String;StartDt,EndDt:Tdatetime);
var
f:TSearchRec;
sPath,sFile: String;
dt:TDateTime;
begin
//æ£æ¥ç®å½ååé¢æ¯å¦æ
'\\'
if
Copy(FilePath,Length(FilePath),1) <>
'\\'
then
sPath := FilePath
+
'\\'
else
sPath := FilePath;
if
FindFirst(sPath+'*.*',faAnyFile, f)= 0 then
begin
repeat
sFile:=Trim(f.Name);
if
sFile='.'
then
Continue;
if
sFile='..'
then
Continue;
sFile:=sPath+f.Name;
if
(f.Attr
and
faDirectory)<>0
then
DelFiles(sFile,StartDt,EndDt)
else
if
(f.Attr and faAnyFile) = f.Attr
then
begin
dt:=FileDateToDateTime(f.Time);
if (dt>StartDt) and (dt<EndDt) then
DeleteFile(sFile);
//å é¤æ件
end;
until
FindNext(f)
<>
0;
FindClose(f);
end;
end;
å¨ä½ çæé®äºä»¶éè°ç¨è¿ä¸ªæ¹æ³
第ä¸ä¸ªåæ°æ¯å®æ´çæ件路å¾
第äºä¸ªæ¯å¼å§æ¶é´
第ä¸ä¸ªæ¯ç»ææ¶é´
æé®é¢çè¨ç»æ
温馨提示:内容为网友见解,仅供参考