//以下是删除g:\下的 *.txt和 *.bmp文件
var
sr : array[0..1] of TSearchRec;
strFile : array[0..1] of String;
begin
if (FindFirst('g:\*.txt', faAnyFile, sr[0]) and FindFirst('g:\*.bmp', faAnyFile, sr[1])) = 0 then
begin
repeat
strFile[0] := 'g:\' + sr[0].Name;
strFile[1] := 'g:\' + sr[1].Name;
DeleteFile(pChar(strFile[0]));
DeleteFile(pChar(strFile[1]));
Until
FindNext(sr[0]) <> 0 and FindNext(sr[1]);