Re: CopyFileEx
- Posted by Jonas Temple <jtemple at yhti.net> Jul 20, 2006
- 500 views
Hmmm...I sent a reply to this yesterday but it never showed up. Maybe I didn't hit the "send" button. Anyway, here's an example of using the routine to manipulate temporary files downloaded to a PC from a host:
-- Now that all files have been transferred loop through each temp file for i = 1 to length(object_list) do local_file = local_path & "\\" & object_list[i] local_temp_file = local_path & "\\~" & object_list[i] -- If the user did not cancel the update then delete/rename the temp file if not cancel_upd then -- Delete the local file rtn_seq = SHFileOperation(getHandle(Main), FO_DELETE, local_file, "", or_all({FOF_SILENT, FOF_NOERRORUI, FOF_NOCONFIRMATION}), 0, "") -- Rename the local temp file to the local file name rtn_seq = SHFileOperation(getHandle(Main), FO_RENAME, local_temp_file, local_file, FOF_SILENT, 0, "") -- Else the user cancelled the component update else -- Delete the temp file rtn_seq = SHFileOperation(getHandle(Main), FO_DELETE, local_temp_file, "", or_all({FOF_SILENT, FOF_NOERRORUI, FOF_NOCONFIRMATION}), 0, "") end if end for
I suggest taking a look at the MSDN docs for this function, it will give you a better understanding of how to use the routine in win32ext. Here's the link: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/shellcc/platform/shell/reference/functions/shfileoperation.asp HTH! Jonas Temple http://www.yhti.net/~jktemple