ImageEn, unit iexWindowsFunctions

WindowsCopy


Declaration

function WindowsCopy(Handle : HWnd; const sFromFilename, sDestFolder: String; bRenameOnCollision, bShowConfirmation, bShowProgress: boolean; bVerboseErrors : boolean = True): Boolean;
function WindowsCopy(Handle : HWnd; ssFiles : TStrings; const sDestFolder : String; bRenameOnCollision, bShowConfirmation, bShowProgress: boolean; bVerboseErrors : boolean = True): Boolean; overload;


Description

Uses PerformSHFileOperation to copy files to a folder.
Parameter Description
sFromFilename/ssFiles The file(s) to copy. If using sFromFilename the multiple files can be delimited using #0
sDestFolder The folder to copy files to
bRenameOnCollision Give the file being operated on a new name if a file with the target name already exists at the destination (pertains to FOF_RENAMEONCOLLISION
bShowConfirmation If not specified then will automatically respond with "Yes to All" for any dialog box that is displayed (undefines FOF_NOCONFIRMATION
bShowProgress Displays a progress dialog box (undefines FOF_SILENT
bVerboseErrors Displays a dialog to the user if an error occurs (undefines FOF_NOERRORUI

Result is true unless the operation fails or is aborted.

Note: Both files and folders can be specified.


Example

WindowsCopy(Form1.Handle, 'C:\My Image.jpg', 'C:\My Files', True, True, True);

// Copy C:\Images to D:\ (the folder D:\Images will be created)
WindowsCopy(Form1.Handle, 'C:\Images', 'D:\', True, True, True);