PDA

View Full Version : move a folder from delphi source?



noeska
17-02-2004, 06:36 PM
How do i move a folder from delphi source? I know how to move a file with movefile. I could create a new folder and do a movefile for every file inside the original folder and then delete that folder. Or is there a smarter way to do this?

Alimonster
17-02-2004, 07:01 PM
SHFileOperation gives you all you want and more. For example:

uses
ShellAPI;

procedure TForm1.Button1Click(Sender: TObject);
var
blah: TSHFileOpStruct;
begin
blah.Wnd := 0;
blah.wFunc := FO_COPY;
blah.pFrom := pchar('e:\unrar\temp');
blah.pTo := PChar('e:\unrar\temp2');
blah.fFlags := FOF_NOCONFIRMMKDIR;
blah.hNameMappings := nil;
blah.lpszProgressTitle := nil;

SHFileOperation(Blah);
end;
Have a look in the win32 help files for all the flags and stuff you can use -- there are plenty (e.g. cool progress dialogues and such).

noeska
17-02-2004, 07:13 PM
thanks!