Jaime
Posts: 2
Joined: Wed Sep 28, 2022 1:13 pm

Delete Specific Files Not Created during Installation

Wed Sep 28, 2022 1:16 pm

Good afternoon,

I understand I can create a File Removal action for a file that would be created during installation. However, during installation, I would like to check if a file (not created during installation) exists in the target computer and deletes it if it exists.

Would that be possible?
Thanks
With kind regards,
Jaime

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

Re: Delete Specific Files Not Created during Installation

Thu Sep 29, 2022 11:25 am

Hello Jaime and welcome to our forums,

That should be possible, through a Custom Action.

For instance, first, we can create a "File Search" that will look for the file on the user's machine.

Let's consider we want to look for the following file: C:\test\test123.txt

We can create a "File Search", as it follows:
Screenshot_7.png
Screenshot_7.png (134.56KiB)Viewed 3253 times

After the search is initially createad, you should right click on it --> "Add search location" --> "Folder"
Screenshot_8.png
Screenshot_8.png (12.92KiB)Viewed 3253 times

After that, you can create a custom action that retrieves the path from the search and then removes the file. In addition to that, you can condition the execution of the custom action based on the search, so it executes only when the search succeeds.



Hope this helps!

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

Return to “Common Problems”