Remove/delete not needed files in installer - Advanced Installer Community
sonda
Posts: 103
Joined: Mon Apr 30, 2018 12:01 pm

Remove/delete not needed files in installer

I have synchronised foldet that have lot of files and some of them i want to remove (test, development configurations).
I have created search, which should find folder but i always on test receive c:\ but not the whole path.
1.png
1.png (20.68 KiB) Viewed 3176 times
In the Files and folders i have created property folder and add remove operation of file, but after installation files are still there.
2.png
2.png (60.22 KiB) Viewed 3176 times
i have attached simple .aip file
Attachments
file-search-delete.aip
(17.88 KiB) Downloaded 266 times
sonda
Posts: 103
Joined: Mon Apr 30, 2018 12:01 pm

Re: Remove/delete not needed files in installer

Also i have tried to do with vb script but although in test search i receive file name in the vb script the session.property() is empty, not sure why search is giving result, but in script is empty
4.png
4.png (16.2 KiB) Viewed 3151 times
Also attached second test .aip

i have read from herehttps://www.advancedinstaller.com/user- ... older.html but i have problems with search, search results in script are always empty
Attachments
file-search-delete-3.aip
(18.43 KiB) Downloaded 264 times
Catalin
Posts: 7852
Joined: Wed Jun 13, 2018 7:49 am

Re: Remove/delete not needed files in installer

Hello Sonda,

Please keep in mind that Installer Properties are available only during the immediate stage of the install execution process. After this stage is complete all property values are set to empty strings.

The exception to this rule is the special CustomActionData property which keeps its values through all of the stages even during deferred, rollback and commit.

Before we begin, please have a look on our "Run Inline PowerShell Script" article where it is described how one can get a property value into a script (for deferred custom actions).

Now, in order to achieve what you want, you can follow the upcoming step-by-step process:

- Please go to "Search" page and create a search for the file that you want to be removed. To do so, you can create a "File Search" type of search.

- Now please go to "Custom Actions" page.

- Here add a "Run Inline PowerShell Script" custom action with sequence. In order to do so, simply press the "Add custom action with sequence" button which is place to the right side of the custom action's name.

- Now it is time to configure the Custom Action. In the "Parameters" field, insert the following:

Code: Select all

-path "[THE_NAME_OF_YOUR_SEARCH]"
Now it is time to update the Param() block of the script, which must be on the first line, as follows:

Code: Select all

Param($path)
Now, under the "# Your code goes here." comment, please add the following line:

Code: Select all

Remove-Item -Path "$path" -Force
This way, upon installing the setup, your file should be successfully removed.

Hope this helps.

All the best,
Catalin
Catalin Gheorghe - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Common Problems”