arad87678
Posts: 1
Joined: Sat Aug 28, 2021 3:07 pm

Picking list of subfolder inside app data subfolder?

Sat Aug 28, 2021 3:25 pm

Hello

I just found out about the Advanced installer and I am a bit confused about the installation directory

My Use case :
I need the installer to put some files into multiple Subfolders inside Roaming folder , but every user has will have a different name for these subfolders
so is there a way to configure the installer to pick those folders automatically for each user ?

For Example :

C:\Users\<User Name>\AppData\Roaming\Exios\Data\<multiple sub folders>\ThisWeek\Today

from the above directory link you can see that I want to put some files into the Today folder
but the problem is <multiple sub folders> these multiple subfolder will have different names for every user

for example for me : folder names could be like this :
1: 6dfs64g5s46sdf54
2: asdera56aafa4z3v5f
3: gr54etre2g5sfs5

and for other users it will be different

but all those subfolders will contain ThisWeek and "Today" folder for every user

so is there a way to grab the names of all those folders and then proceed to put the files into "Today "folder for every sub folder ?

Thank you

Catalin
Posts: 6537
Joined: Wed Jun 13, 2018 7:49 am

Re: Picking list of subfolder inside app data subfolder?

Tue Aug 31, 2021 5:03 pm

Hello and welcome to our forums,

If I understand correctly, what you want to achieve here is retrieving a path using wildcards.

Unfortunately, a built-in support for this is not available.

However, it is possible to achieve what you want, under a condition - the number of folders with random names should be known.

To do this, we will proceed as it follows:

- create a property that will store our path

- create a property based folder in "Files and Folders" page

- create a Custom Action that will retrieve the path and the set the above property to its' value


1. In order to create a property, please go to "Properties" page
DummyProperty.png
DummyProperty.png (12.89KiB)Viewed 5567 times

Please note that this is a dummy property hat for now holds no real value - as you can see, its' value is "test".

2. In order to create a property based folder, please go to "Files and Folders" page --> right click on any folder --> "New Folder" --> "Property Based" --> select the earlier created property

3. We will now need to create a Custom Action

For the sake of this example, let's consider exactly your path:

C:\Users\Catalin\AppData\Roaming\Exios\Data\6dfs64g5s46sdf54\asdera56aafa4z3v5f\gr54etre2g5sfs5\ThisWeek\Today

In order to retrieve that path using wildcards, I have used PowerShell and it looks as it follows:
targetPath.png
targetPath.png (32.55KiB)Viewed 5567 times

Code: Select all

$targetPath = resolve-path $env:appdata\Exios\Data\*\*\*\ThisWeek\Today | select -ExpandProperty Path
Of course, here you are free to use any language you want/are more confortable with.

The next step would be to create this custom action in Advanced Installer. To do so:

3.1. go to "Custom Actions" page

3.2. add the "PowerShell Script Inline" custom action

3.3. set the MY_PATH property to the value of $targetPath
CA.png
CA.png (101.19KiB)Viewed 5567 times

Hope this helps!

Best regards,
Catalin
Catalin Gheorghe - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Building Installers”