Currently able to copy a selection of files using a wildcard:
Source: "{#source}\name.*.ini"; DestDir: "{#dest}\folder"; Flags: ignoreversion;
But when trying to add DestName to rename each copied file and add a .example
extension, it returns an error that:
Parameter "DestName" cannot be specified if the "Source" parameter contains wildcards.
Is there an elegant solution to this, or would it require some function to rename each copied file?
There's no simple solution for this in Inno Setup.
You can use preprocessor to generate individual entries for each file.
[Files]
#define FindHandle
#define FindResult
#sub ProcessFoundFile
#define FileName FindGetFileName(FindHandle)
Name: "{#source}\{#FileName}"; DestDir: "{#dest}\folder"; \
DestName: "{#FileName}.example"; Flags: ignoreversion
#endsub
#for {FindHandle = FindResult = FindFirst(source + "\name.*.ini", faAnyFile); \
FindResult; FindResult = FindNext(FindHandle)} ProcessFoundFile
#expr FindClose(FindHandle)
Put this at the end of your script to see and review, what the preprocessor generated:
#expr SaveToFile(AddBackslash(SourcePath) + "Preprocessed.iss")
You should get something like this:
[Files]
Source: "C:\source\foo.ini"; DestDir: "dest"; DestName: "foo.ini.example"; Flags: ignoreversion
Source: "C:\source\bar.ini"; DestDir: "dest"; DestName: "bar.ini.example"; Flags: ignoreversion
...