How to remove folder before file copying in basic MSI project

I Want to remove the folder before starting "file copying" steps. I tried with install script it's not deleting the folder due to UAC Settings.So i dont know how to solve the issue.

Can you help me in this regards.. 

0 Comments   [ + ] Show comments

Answers (2)

Posted by: anonymous_9363 8 years ago
Red Belt

Use the RemoveFile table.

The situation is more complicated if the files are in the user's profile, of course.

Posted by: EdT 8 years ago
Red Belt
We really need to know where the folder is located and also what context the MSI will run in.
Running a script as a "user account" will inevitably launch the UAC, but running the same script as the local system account will not.  Additionally, if any of the files in the folder(s) you are trying to delete are locked "in use", they cannot be deleted.
As VBScab states above, the RemoveFile table is the logical tool to use, and it accepts wildcards, but you need to know the directory structure if there is more than one directory in the tree as they need to be emptied and deleted from the bottom of the tree.
An alternative solution is to look for a vbscript that does a "deltree" operation and run this deferred ahead of the InstallFiles action in the InstallExecute sequence. This code can then be equipped with sufficient error trapping so that you can decide on whether to continue the install if the folder is not empty, or rollback.

Don't be a Stranger!

Sign up today to participate, stay informed, earn points and establish a reputation for yourself!

Sign up! or login

View more:


This website uses cookies. By continuing to use this site and/or clicking the "Accept" button you are providing consent Quest Software and its affiliates do NOT sell the Personal Data you provide to us either when you register on our websites or when you do business with us. For more information about our Privacy Policy and our data protection efforts, please visit GDPR-HQ