Definitely go with SHFileOperation () , as suggested above, CopyFile is too slow for many files. It looks like you are basically restoring the entire folder, so the search function may be unnecessary and slow down. Something like this might help:
uses ShellApi; function CopyDir(const fromDir, toDir: string): Boolean; var fos: TSHFileOpStruct; begin ZeroMemory(@fos, SizeOf(fos)); with fos do begin wFunc := FO_COPY; fFlags := FOF_FILESONLY; pFrom := PChar(fromDir +
This function will raise a request to overwrite existing files (perhaps it can be changed to skip this), but the user can select "All", so a one-click procedure, much faster, has a progress bar and can be canceled if necessary.
Eagleofffoledo
source share