Page 1 of 1
how can I delete a folder and its contents?
Posted: Thu Aug 29, 2013 4:19 am
by JohnO
As part of uninstall, I want to remove a folder and its content, that was created by the running application.
I have managed to delete a folder which only has one file (the log) with:
Code: Select all
Delete Files $MYPROFILES$\Romonet\$TITLE$\logging\romonet.log (when uninstalling)
The other folders have too much content to remove in this way. I simply want to remove a folder and all of its contents (like 'delete' in Windows Explorer).
I have tried the following, without any success:
Code: Select all
Recursively Delete Files $INSTALLDIR$\configuration
What do I need to do?
BTW, this code is in
Code: Select all
[DEFINE REGION: Perform Uninstallation]
Regards, John
Re: how can I delete a folder and its contents?
Posted: Thu Aug 29, 2013 12:34 pm
by FrancescoT
Dear John,
With the command "Delete Files Recursive", enter the full path and wildcard pattern for the files to delete.
Supposing that you want to delete all folder contents, you should use;
$INSTALLDIR$\configuration\*.*
Regards
Re: how can I delete a folder and its contents?
Posted: Fri Aug 30, 2013 4:49 am
by JohnO
Dear Francesco
Thanks. I can feel a 'Duh!' moment coming on.
John
Re: how can I delete a folder and its contents?
Posted: Fri Aug 30, 2013 8:24 am
by JohnO
Dear Francesco
The delete at uninstall time is not happening. I wonder if I am doing these in the wrong place or time. I have tried when NATIVE_ENGINE is true and when false.
Code: Select all
[DEFINE REGION: Perform Uninstallation]
if Variable REMOVE Equals TRUE
Comment: Uninstall product
Comment: TO-DO: Insert any additional uninstall commands here
Set Variable NATIVE_ENGINE to TRUE
Move Local Files $MYPROFILES$\Romonet\$TITLE$\resources\*.* to $MYPROFILES$\Romonet\$TITLE$\resources_old\ (include subfolders)
Recursively Delete Files $MYPROFILES$\Romonet\$TITLE$\logging\*.*
Recursively Delete Files $MYPROFILES$\Romonet\$TITLE$\workspace\*.*
Recursively Delete Files $INSTALLDIR$\configuration\*.*
Recursively Delete Files $INSTALLDIR$\p2\*.*
Set Variable NATIVE_ENGINE to FALSE
Apply Uninstall (get result into variable SUCCESS)
Set Variable PROGRESS to 100
else
<<Code Folding Region>>
I have run this where NATIVE_ENGINE is set to false, after the Move. Neither way works.
BTW, the 'Move' does work (as advised in other append), I see it happen early on in the unistall, as the 'resources' folder was installed, that gets removed, so I am effectively left with a renamed folder.
Regards, John
Re: how can I delete a folder and its contents?
Posted: Fri Aug 30, 2013 10:55 am
by FrancescoT
Dear John,
could you please post a very minimal project that replicates your issue?
Regards