Option Explicit
Public Type SHFILEOPSTRUCT
hwnd As Long 'The handle of the window calling the function
wFunc As Long 'One of the FO_ constants below
pFrom As String 'Path and file name of the file to acted on. Usual wildcards allowed
pTo As String 'Destination path/filename for move, copy and rename operations
fFlags As Integer 'Additional options - not fully documented
fAnyOperationsAborted As Long 'No information on this flag
hNameMappings As Long 'No information on use.
lpszProgressTitle As String 'Only used if FOF_SIMPLEPROGRESS is not specified
End Type
Public Declare Function SHFileOperation Lib _
"shell32.dll" Alias "SHFileOperationA" _
(lpFileOp As SHFILEOPSTRUCT) As Long
' wFunc - type of operation constants. Assign one of these to wFunc
Public Const FO_MOVE = &H1
Public Const FO_COPY = &H2
Public Const FO_DELETE = &H3
Public Const FO_RENAME = &H4
' fFlags - can be OR'd together to provide extra options when the file operation is executed
Public Const FOF_MULTIDESTFILES = &H1
Public Const FOF_CONFIRMMOUSE = &H2
Public Const FOF_SILENT = &H4 'don't create progress/report
Public Const FOF_RENAMEONCOLLISION = &H8
Public Const FOF_NOCONFIRMATION = &H10 'don't prompt the user.
'fill in SHFILEOPSTRUCT.hNameMappings Must be freed using SHFreeNameMappings
Public Const FOF_WANTMAPPINGHANDLE = &H20
Public Const FOF_ALLOWUNDO = &H40 'sends a file to the recycle bin instead of permanently deleting it
Public Const FOF_FILESONLY = &H80 'on *.*, do only Files -Not directories
Public Const FOF_SIMPLEPROGRESS = &H100 'don't show names of files during the operation
Public Const FOF_NOCONFIRMMKDIR = &H200 'don't confirm making any needed directories