Hola.
Si estas usando
Lazarus bajo el S.O.
Windows podes hacer:
Código Delphi
[-]
...
uses Windows, ShellApi;
function MoveDir(const fromDir, toDir: string): Boolean;
var
fos: TSHFileOpStruct;
begin
ZeroMemory(@fos, SizeOf(fos));
fos.wFunc := FO_MOVE;
fos.fFlags := FOF_NOCONFIRMMKDIR + FOF_RENAMEONCOLLISION;
fos.pFrom := PChar(fromDir + #0);
fos.pTo := PChar(toDir);
Result := ShFileOperation(fos) = 0;
end;
Un ejemplo de uso:
Código Delphi
[-]
procedure TForm1.Button1Click(Sender: TObject);
begin
if not MoveDir('C:\Folder_A', 'C:\Folder_B\SubFolder_B\Folder_A') then
ShowMessage('Error moviendo directorio');
end;
Saludos
