ImageEn, unit iexWindowsFunctions

WindowsMove


Declaration

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


Description

Uses PerformSHFileOperation to move files to a folder.
Parameter Description
Handle Owner Handle. Can specify 0
sFromFilename/ssFiles The file(s) to move. If using sFromFilename the multiple files can be delimited using #0
sDestFolder The folder to move 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

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

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