Archive: Newbie Question: Indicating multiple files...


Newbie Question: Indicating multiple files...
When building a script for NSIS, I was wondering if the following syntax was valid for identifying more than one file which I'd like to add to a distribution...

Section "Foobar"
SetOutPath "C:\DestDir"
File "C:\SourceDir\MyFile.txt" "C:\SourceDir\YourFile.txt" "C:\SourceDir\HisFile.txt"
SectionEnd

... or if I want to do multiple files, am I limited to using wildcards?

Regards,
Corporate Dog


Yes, you are limited to wildcards in one statement. If you want to do it like this, you have to use multiple file statements:


File "C:\SourceDir\MyFile.txt"
File "C:\SourceDir\YourFile.txt"
File "C:\SourceDir\HisFile.txt"

With wildcards it could possibly be:

File "C:\SourceDir\*.txt"

But then you'd either have to put them in a seperate folder, or you'll have to make sure these are the only txt files.

Hi,

according to the NSIS Documentation use:


Section "Foobar"
SetOutPath "C:\DestDir"
File "C:\SourceDir\MyFile.txt"
File "C:\SourceDir\YourFile.txt"
File "C:\SourceDir\HisFile.txt"
SectionEnd


Regards,
~ Flo

Hmmm... alright. In that case, would there be some alternative way to pass in an unknown number of files on the compiler command line? I was originally going with a space delimited string of filenames passed in as a new symbol, but that's clearly not going to work.

The best I can come up with now, is to limit the number of files that can be identified on the command line (to maybe 10) and then add each of the filenames as new symbols.

Regards,
Corporate Dog


I'm not fully understading what you are trying to do. It would seem you want a 'flexible' script which does not have all files it contains set.

You could try something like:

Section SomeThing
File MyFile.txt
!include "filelist.nsh"
File Anotherfile.txt
SectionEnd


Where the filelist.nsh file contains just a flexible number of files, like:
File SomeFIle.txt
File ANoteratnor.txt
and so on.

[Edit oops]
Instead of doing it on the commandline, you could first write it to the filelist.nsh file perhaps? (could even be done in batch files with echo statements and shift, though it won't win any beauty contests).

Koen,

That's exactly what I was looking for. Thanks!

Regards,
Corporate Dog


Or you could use the recursive function of adding a folder if the files were all in one folder but if not i guess that the .nsh would be the way to go.

Section "My Favorite Skins"
SectionIn 12
File /r "D:\Programs\WINAMP\Cool Skins"
SectionEnd

the "R" switch being added /r


WA3 and NSIS rock!