procedure
TForm1.Button1Click(Sender: Tobject);
var Dir: TSearchRec;
a : Integer;
begin
a := FindFirst('C:\MonRepertoire\*.*', FaAnyfile, Dir);
while a = 0 do
begin
if ((Dir.Attr and FaDirectory <> FaDirectory) and
(Dir.Attr and FaVolumeId <> FaVolumeID)) then
if DeleteFile(pChar('C:repertoire' + Dir.Name))=
false then
ShowMessage('Déstruction impossible');
a := FindNext(Dir);
end;
SysUtils.FindClose(Dir);
if RemoveDirec to ry('C:repertoire') = false then
ShowMessage('Déstruction impossible');
end;
|