Deleting an entire folder before the installation begins using the setup script

35 views
Skip to first unread message

Jan Bleiss

unread,
Apr 7, 2026, 12:49:09 PMApr 7
to innosetup
I need to delete an entire folder from the installation directory before installation. I can’t do this using the standard delete function in InnoScript Studio, as it requires the items to be deleted to have been installed beforehand. Is there a way to instruct the script to carry out this deletion task before the files are installed?

Martijn Laan

unread,
Apr 7, 2026, 1:18:57 PMApr 7
to innosetup
Hi,

Op 7-4-2026 om 18:49 schreef Jan Bleiss:
I need to delete an entire folder from the installation directory before installation.

Add this:

[InstallDelete]
Type: filesandordirs; Name: "{app}\Bad Folder"

Also see https://jrsoftware.org/ishelp/index.php?topic=installorder

And, be aware of what the help file says about the Name parameter:

"NOTE: Don't be tempted to use a wildcard here to delete all files in the {app} directory. Doing this is strongly recommended against for two reasons. First, users usually don't appreciate having their data files they put in the application directory deleted without warning (they might only be uninstalling it because they want to move it to a different drive, for example). It's better to leave it up to the end users to manually remove them if they want. Also, if the user happened to install the program in the wrong directory by mistake (for example, C:\Windows) and then went to uninstall it there could be disastrous consequences. So again, DON'T DO THIS!"

Greetings,
Martijn
Reply all
Reply to author
Forward
0 new messages