Hello,
Is the folder created on the disk by your package or is the folder already on the machine? Also, when you want to perform this operation, during the install of your package or during an uninstall?
For instance, if the folder is already on the disk and you want to remove it during the installation of your package, you can use a script (e.g. PowerShell, VBScript, etc) that can search for it and remove its content. For instance, if we have the following folder on the machine:
C:\
--->MyFolder
------>MySubFolder
------>someFile.txt
a simple PowerShell script which will delete the content of the folder, except the subfolder would be:
Code: Select all
Get-ChildItem C:\MyFolder -Exclude MySubFolder | Remove-Item -Recurse -Force
Basically, the Get-ChildItem will get the content of the "MyFolder" folder:

- Get-ChildItem.png (31.04 KiB) Viewed 5444 times
The "-Exclude" parameter is used to exclude our folder from it:

- Get-ChildItemExclude.png (8.04 KiB) Viewed 5444 times
The PowerShell script can be added to your project as a
"Run Inline PowerShell script" custom action. It should be scheduled during the
"Remove Resources" action group, with its execution time being of
"When the system is being modified (deferred)".
The above scenario is mostly intended for when you need to do the deletion during install (when the folder is already present on the disk).
If you want to to this during the uninstall (to remove a folder that was created by your package), please let me know as we may have to do some more modifications.
Hope this helps.
Best regards,
Catalin