Archive: CopyFiles


CopyFiles
Hi there,

can anyone help me with a tricky problem. I'm using CopyFiles to copy approx 4.2GB of data from a DVD. The actual process completes properly (I can check each file that has been copied and it is a perfect copy of the original DVd copy), but the error flag is always set (so im always notified of the error...

This is my code:

Section "CopyData1"
copy:
CreateDirectory "$INSTDIR\Data\VTL"
CopyFiles "$EXEDIR\VTL_DVD1\*.*" "$INSTDIR\Data\VTL"
IfErrors error doneIt

; Check if there has been an error - if yes prompt
error:
MessageBox MB_OK|MB_ICONSTOP "Error!"
MessageBox MB_YESNO|MB_ICONQUESTION "Do you wish to retry the transfer process?" IDYES copy
Abort

doneIt:

SectionEnd

Anyone got any ideas??


Here's a straw....Perhaps the directory already existed so the createdirectory functions error flag was set?


Perhaps the directory already existed so the createdirectory functions error flag was set?
I tried removing the createdirectory function, plus ensured everything was clean and nothing pre existed. Still no joy... But heres the really odd thing. If i click yes in my onerror handler to redo the copy -> It works :eek:

Hmm, perhaps the dialog that appears when you don't use /SILENT is causing the error flag to be set since you didn't supply the size in kb.


Try placing an iferror every other line, so we can determine where it is being set. (You'll need a custom error for each one)

P.S. don't forget to place one right after the section command, so we know a previous section or function didn't set it.


The error may not be coming from your CopyFiles at all. I don't see it in your trimmed down script so you might try adding "ClearErrors" before your CopyFiles just to make sure the error flag wasn't set for something earlier.


apart from your problem:

as you said you're copying 4.2GB of files, you might wanna use a macro to copy the files, which checks if copying for each file was successful. otherwise if you have one mistake, you will have to copy the entire 4.2GB again.


BTW how SHFileOperation handles "*.*" notation? Can it lost files without extensions ? :)


Hi guys,

thanks for all the help so far. ClearErrors seems to be doing the job