Форум: "Основная";
Текущий архив: 2002.01.08;
Скачать: [xml.tar.bz2];
ВнизУдаление содержимого каталога Найти похожие ветки
← →
Dimka Maslov (2001-12-20 16:05) [2]
uses Windows, SysUtils, Classes, Masks;
procedure DeleteFiles(Path: string);
var
Mask: string;
SearchRec: TSearchRec;
FindResult: Integer;
List: TStringList;
i: Integer;
begin
Mask:=ExtractFileName(Path);
if Mask = "" then Mask:="*.*";
Path:=ExtractFilePath(Path);
if Path = "" then Path:=IncludeTrailingBackslash(GetCurrentDir);
List:=TStringList.Create;
try
FindResult:=FindFirst(Path+"*.*", faAnyFile, SearchRec);
try
while FindResult = 0 do with SearchRec do begin
if ((Attr and faDirectory) = 0) and MatchesMask(Name, Mask) then
List.Add(Name);
FindResult:=FindNext(SearchRec);
end;
for i:=0 to List.Count - 1 do DeleteFile(Path+List[i]);
finally
FindClose(SearchRec);
end;
finally
List.Free;
end;
end;
Страницы: 1 вся ветка
Форум: "Основная";
Текущий архив: 2002.01.08;
Скачать: [xml.tar.bz2];
Память: 0.43 MB
Время: 0.156 c