Try using this.
#constant User32 1
#constant Shell32 2
#constant FO_COPY 0x0002
#constant FOF_NOCONFIRMATION 0x0010
#constant FOF_NOCONFIRMMKDIR 0x0200
type t_SHFILEOPTSTRUCT
hWnd as dword
wFunc as dword
pFrom as string
pTo as string
fFlags as integer
fAnyOperationsAborted as dword
hNameMappings as dword
lpszProgressTitle as dword
endtype
dim fop() as t_SHFILEOPTSTRUCT
copyFolder("SrcDir", "DestDir")
wait key
end
function copyFolder(fromFolder as string, toFolder as string)
local Result as integer
local hWnd as integer
fromFolder = fromFolder+"\*.*"
load dll "user32.dll", User32
load dll "shell32.dll", Shell32
hWnd = call dll(User32, "GetActiveWindow")
array insert at bottom fop()
fop().hWnd = hWnd
fop().wFunc = FO_COPY
fop().pFrom = fromFolder
fop().pTo = toFolder
fop().fFlags = FOF_NOCONFIRMATION || FOF_NOCONFIRMMKDIR
Result =call dll(Shell32, "SHFileOperation", fop())
empty array fop()
delete dll User32
delete dll Shell32
endfunction Result