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!

congnt92
Posts: 57
Joined: Wed Apr 16, 2014 7:53 am

Remove folder when it is using

Hi.
I create a setup file which create a folder in C:\ in the installation. I call this folder is "Backup" (C:\backup). And when user run my app, it will backup the boot.ini file to "backup" folder with name "Boot_backup.ini". But when I uninstall, the backup folder was not removed. Because it's not empty. I use operations tab in File and folder page for Backup folder, choose "remove folder event if it is not empty". It work fine. But if I open boot_backup.ini file by an editor programs, such as notepad then run the uninstaller, boot_backup.ini file was deleted but backup folder was not removed because boot_backup.ini is using. So, I want to the uninstaller popup the dialogue which detect boot_backup.ini is using then ask user close it to continuing uninstall. Can you help me? Thanks
Dan
Posts: 4530
Joined: Wed Apr 24, 2013 3:51 pm

Re: Remove folder when it is using

Hello,
So, I want to the uninstaller popup the dialogue which detect boot_backup.ini is using then ask user close it to continuing uninstall. Can you help me? Thanks
In order to check if a certain file is in use, you can create your own custom action. If you detect the related file is in use, then you can prompt the user.
For example, you can create your custom action as a custom action written in C# or a custom action written in C++.

Then you can go in the “Custom Actions” page and add a predefined Launch attached file custom action with sequence after the Searches stage from the Install Execution Stage.
This type of custom action can execute an application (EXE or DLL) or run a script (VBScript or Java script). Also, the source file will be embedded in the MSI file but will not be deployed at install time with the other application files. Also, you can condition this custom action to be executed only on Uninstall.

Please take a look on the Is there a way to check if a file is in use? thread which may be useful to you.

Please let us know if that helped.

Best regards,
Dan
Dan Ghiorghita - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
congnt92
Posts: 57
Joined: Wed Apr 16, 2014 7:53 am

Re: Remove folder when it is using

Thanks, Dan.
Special thing here is .ini file. We open a .pdf file by foxit. When we delete it, we will get "file in use" dialogue. But if we open .ini (.txt, ,inf) file (such as by notepad), we can delete it.
So if we using uninstall cleanup for a folder which content a .ini file is openning, the uninstaller will del .ini file but it cannot remove folder. And result, the folder is empty, not completely remove.
May there's no way to remove folder completely in this case.

Return to “Building Installers”