How to copy a single file?
I have a problem with copying files one at a time. I'm trying to do a section where I read a string from a file and the use it to determine if a file exists in some directory. If it doesn't exists a file corresponding to the string will be copied to the target directory from a temp directory, if the file(in some form, <string>-*.jar) exists the user will be asked if (s)he wants to overwrite the old file with the new.
For now I'm just trying to copy all the files one at a time using CopyFiles, but I usually get an error or nothing happens.
Something like this:
FileOpen $1 "$INSTDIR\strings.txt" "r"
loop:
FileRead $1 $2
IfErrors done
CopyFiles /FILESONLY "$INSTDIR\somedir\$2*.jar" "$TARGETDIR"
IfErrors copyFailed
Goto loop
done:
MessageBox MB_OK "Done."
FileClose $1
Return
copyFailed:
MessageBox MB_OK "Copy operation failed."
FileClose $1
Return
O.