Just upgraded our NSIS version to the latest, as we were on 2.02, and we need the file exclude /x functionality in 2.03 and later.
I have tried 2.06, and cannot get the exclude to work. What we want to do, is have a single file command with a wildcard to recursivly add everything, and overwrite ALL files, except a single file, where we want to leave it, if it's ready present.
The snippet of code that does not seem to be working is:
SetOverwrite try
SetOutPath "$INSTDIR"
File /nonfatal /r /x "DeployFolder\Dont_overwrite_me.pdf" "DeployFolder\*.*"
SetOverwrite off
File /nonfatal "DeployFolder\Dont_overwrite_me.pdf"
SetOverwrite try
Cannot get file /x to work in NSIS 2.06
7 posts
Have you tried:
File /nonfatal /r /x "Dont_overwrite_me.pdf" "DeployFolder\*.*"
I think /x only works for file names not full paths.
-Stu
File /nonfatal /r /x "Dont_overwrite_me.pdf" "DeployFolder\*.*"
I think /x only works for file names not full paths.
-Stu
/x works only with file names, not relative or absolute paths.
You might want to consider updating the help file, as this was not obvious when I read it...or perhaps it was just me being thick.. :-)
What if I have a folder with other subfolders and want to exclude certain files within those subfolders. E.g. let's say I have folder a which contains folders b, c and d. In b, c and d I want to exclude any .tmp files. Also in b, c and d there are files of the same name - bob.txt. But I only want to exclude bob.txt from the c folder. How would I code that? Would I be able to do it in one line or would I have to break it up?
Originally posted by richiebabesI guess you would have to do it manually:
Also in b, c and d there are files of the same name - bob.txt. But I only want to exclude bob.txt from the c folder. How would I code that? Would I be able to do it in one line or would I have to break it up?
SetOutPath "$INSTDIR\a\b"
File "a\b\*.*"
SetOutPath "$INSTDIR\a\c"
File /x bob.txt "a\c\*.*"
SetOutPath "$INSTDIR\a\d"
File "a\d\*.*"
Yeah, I figured as much. Oh well!