|
|
#1 |
|
Junior Member
Join Date: Jan 2005
Posts: 2
|
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. |
|
|
|
|
|
#2 |
|
Major Dude
|
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. hand by comm@nder21 ---------- WiKi pages:CreateInternetShortcut|Enhanced FindWindow|Parse CSV-Data|Open/Close CD-Drive|Installer without Icon|Vista application compatibility |
|
|
|
|
|
#3 |
|
M.I.A.
[NSIS Dev, Mod] Join Date: Oct 2001
Location: Israel
Posts: 11,343
|
NSIS FAQ | NSIS Home Page | Donate $ "I hear and I forget. I see and I remember. I do and I understand." -- Confucius |
|
|
|
|
|
#4 |
|
Moderator
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
|
"Delete/FileOpen/CopyFiles don't work"
Please change it "do not" or "doesn't"! -Stu |
|
|
|
|
|
#5 |
|
Junior Member
Join Date: Jan 2005
Posts: 2
|
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. |
|
|
|
![]() |
|
|||||||
| Thread Tools | Search this Thread |
| Display Modes | |
|
|