'To - From, From - To Flags
'File Op Flags
CONST FOF_MULTIDESTFILES
= &H1 CONST FOF_CONFIRMMOUSE
= &H2 CONST FOF_RENAMEONCOLLISION
= &H8 CONST FOF_NOCONFIRMATION
= &H10 CONST FOF_WANTMAPPINGHANDLE
= &H20 CONST FOF_ALLOWUNDO
= &H40 CONST FOF_FILESONLY
= &H80 CONST FOF_SIMPLEPROGRESS
= &H100 CONST FOF_NOCONFIRMMKDIR
= &H200 CONST FOF_NOERRORUI
= &H400 CONST FOF_NOCOPYSECURITYATTRIBS
= &H800 CONST FOF_NORECURSION
= &H1000 CONST FOF_NO_CONNECTED_ELEMENTS
= &H2000 CONST FOF_WANTNUKEWARNING
= &H4000 CONST FOF_NORECURSEREPARSE
= &H8000 CONST FOF_NO_UI
= FOF_SILENT
'Return Values
CONST DE_MANYSRC1DEST
= &H72 CONST DE_OPCANCELLED
= &H75 CONST DE_DESTSUBTREE
= &H76 CONST DE_ACCESSDENIEDSRC
= &H78 CONST DE_PATHTOODEEP
= &H79 CONST DE_INVALIDFILES
= &H7C CONST DE_DESTSAMETREE
= &H7D CONST DE_FLDDESTISFILE
= &H7E CONST DE_FILEDESTISFLD
= &H80 CONST DE_FILENAMETOOLONG
= &H81 CONST DE_DEST_IS_CDROM
= &H82 CONST DE_DEST_IS_DVD
= &H83 CONST DE_DEST_IS_CDRECORD
= &H84 CONST DE_FILE_TOO_LARGE
= &H85 CONST DE_SRC_IS_CDROM
= &H86 CONST DE_SRC_IS_DVD
= &H87 CONST DE_SRC_IS_CDRECORD
= &H88 CONST DE_ERROR_MAX
= &HB7 CONST ERRORONDEST
= &H10000 CONST DE_ROOTDIR_ERRORONDEST
= &H10074
FUNCTION FileOperation%
ALIAS SHFileOperationA
(lpFileOp
AS SHFILEOPSTRUCTA
)
'Test code
PRINT Copy
(_DIR$("desktop") + "this is a test.txt", _DIR$("desktop") + "this is a test as well.txt") PRINT Rename
(_DIR$("desktop") + "this is a test as well.txt", _DIR$("desktop") + "this is a test also.txt") PRINT Recycle
(_DIR$("desktop") + "this is a test also.txt")
DIM lpFileOp
AS SHFILEOPSTRUCTA
file = file + doublenull
lpFileOp.wfunc = FO_DELETE
lpFileOp.fFlags = FOF_ALLOWUNDO + FOF_WANTNUKEWARNING
Recycle = FileOperation(lpFileOp)
DIM lpFileOp
AS SHFILEOPSTRUCTA
file = file + doublenull
dest = dest + doublenull
lpFileOp.wfunc = FO_COPY
lpFileOp.fFlags = FOF_ALLOWUNDO
Copy = FileOperation(lpFileOp)
DIM lpFileOp
AS SHFILEOPSTRUCTA
file = file + doublenull
dest = dest + doublenull
lpFileOp.wfunc = FO_MOVE
lpFileOp.fFlags = FOF_ALLOWUNDO
Move = FileOperation(lpFileOp)
DIM lpFileOp
AS SHFILEOPSTRUCTA
file = file + doublenull
newname = newname + doublenull
lpFileOp.wfunc = FO_RENAME
lpFileOp.fFlags = FOF_ALLOWUNDO
Rename = FileOperation(lpFileOp)