uses ExtCtrls, ShellApi
//
procedure RenameDir(DirFrom, DirTo: string);
var
shellinfo: TSHFileOpStruct;
begin
with shellinfo do
begin
Wnd := 0;
wFunc := FO_RENAME;
pFrom := PChar(DirFrom);
pTo := PChar(DirTo);
fFlags := FOF_FILESONLY or FOF_ALLOWUNDO or
FOF_SILENT or FOF_NOCONFIRMATION;
end;
SHFileOperation(shellinfo);
end;
Beispiel :
procedure TForm1.Button1Click(Sender: TObject);
begin
RenameDir('C:\tempa', 'C:\tempb');
end;
Keine Kommentare:
Kommentar veröffentlichen