We’re moving our forums to a new platform.

You can still browse and search existing topics, but you can no longer create new topics or post replies.

For questions, technical issues, or feature requests, please don’t hesitate to contact our support team at support@advancedinstaller.com.

Thank you for your understanding!

alter_ego_dev2
Posts: 25
Joined: Wed May 10, 2023 4:09 pm

How to add a file only if the file exists?

Hey,
I would like to add a file with the condition: if a file exists in some physical source (folder), add it to the target location specific patch (like, we do it in Files and Folders section.) The "Condition files" button has predefined conditions (most of them check prerequisites), but I can't find a condition to check if the file exists.
I guess another option would be a custom action, but I'm not sure how to get a file if it didn't include in "Files and Folders" to specific folder.
Catalin
Posts: 7853
Joined: Wed Jun 13, 2018 7:49 am

Re: How to add a file only if the file exists?

Hello,

In order to achieve that, you can create a batch script that:

1. checks if the file exists

2. if yes, then uses the AddFile command option

Note: You can achieve something similar with the PowerShell automation support as well.

Hope this helps!

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

Return to “Common Problems”