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.
How to copy a single file?
5 posts
IfFileExists checks if your file is already existing in $TARGETDIR.
for string operations, use TextFunc.nsh and WordFunc.nsh.
there's a forum thread somewhere, where the current versions are posted regularly.
for string operations, use TextFunc.nsh and WordFunc.nsh.
there's a forum thread somewhere, where the current versions are posted regularly.
"Delete/FileOpen/CopyFiles don't work" 😢
Please change it "do not" or "doesn't"! 😛
-Stu
Please change it "do not" or "doesn't"! 😛
-Stu
Thanks all. Figured it out on my own.
The problem were the new line characters. I got the imression from the help that those characters wouldn't be in the string, so that didn't come to mind until yesterday.
O.
The problem were the new line characters. I got the imression from the help that those characters wouldn't be in the string, so that didn't come to mind until yesterday.
O.