how can I delete a folder and its contents?

Got a problem you cannot solve? Try here.
JohnO
Posts: 127
Joined: Tue Jun 18, 2013 9:52 am

how can I delete a folder and its contents?

Postby JohnO » Thu Aug 29, 2013 4:19 am

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

FrancescoT
Site Admin
Posts: 5361
Joined: Sun Aug 22, 2010 4:28 am

Re: how can I delete a folder and its contents?

Postby FrancescoT » Thu Aug 29, 2013 12:34 pm

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
Francesco Toscano
InstallAware Software

White Papers (HowTos) - http://www.installaware.com/publication ... papers.htm
Publications - http://www.installaware.com/publications-review.htm
InstallAware Help -F1 anywhere in the InstallAware IDE

JohnO
Posts: 127
Joined: Tue Jun 18, 2013 9:52 am

Re: how can I delete a folder and its contents?

Postby JohnO » Fri Aug 30, 2013 4:49 am

Dear Francesco
Thanks. I can feel a 'Duh!' moment coming on.

John

JohnO
Posts: 127
Joined: Tue Jun 18, 2013 9:52 am

Re: how can I delete a folder and its contents?

Postby JohnO » Fri Aug 30, 2013 8:24 am

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

FrancescoT
Site Admin
Posts: 5361
Joined: Sun Aug 22, 2010 4:28 am

Re: how can I delete a folder and its contents?

Postby FrancescoT » Fri Aug 30, 2013 10:55 am

Dear John,

could you please post a very minimal project that replicates your issue?

Regards
Francesco Toscano
InstallAware Software

White Papers (HowTos) - http://www.installaware.com/publication ... papers.htm
Publications - http://www.installaware.com/publications-review.htm
InstallAware Help -F1 anywhere in the InstallAware IDE


Return to “Technical Support”

Who is online

Users browsing this forum: No registered users and 132 guests