Delete files not working

Got a problem you cannot solve? Try here.
mikKummerfeld
Posts: 252
Joined: Sat Dec 03, 2011 3:07 am
Location: Konstanz, Germany
Contact:

Delete files not working

Postby mikKummerfeld » Fri Apr 13, 2012 3:06 am

Hey Guys,

delete files (while installing) is not possible in the following constellation.

1. I Install all files from D:\installfiles\olap\*.* into $COREDIR$ (same as Targetdir)
2. Then I need to delete 3 files from $TARGETDIR$ while installing our client mode.

Result: Files are still there after installation.
Attachments
delete_files.png
delete_files.png (20.81 KiB) Viewed 12870 times
Kind regards

Heiko Kummerfeld
MIK GmbH

Setup developer for .NET BI Software (12 products)
Head of quality assurance
technical consultant

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

Re: Delete files not working

Postby FrancescoT » Fri Apr 13, 2012 8:30 am

Dear Heiko,

can you try to be more specific, the files that you want to delete are already available on target OS or are you installing these?

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

mikKummerfeld
Posts: 252
Joined: Sat Dec 03, 2011 3:07 am
Location: Konstanz, Germany
Contact:

Re: Delete files not working

Postby mikKummerfeld » Sun Apr 15, 2012 11:47 pm

I installing these and after that I want to delete a few files.
I can't install every 250 files one by one to avoid this.
Kind regards

Heiko Kummerfeld
MIK GmbH

Setup developer for .NET BI Software (12 products)
Head of quality assurance
technical consultant

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

Re: Delete files not working

Postby FrancescoT » Mon Apr 16, 2012 9:16 am

Dear Heiko,

First of all, it is not a good practice to remove files that are part of the installation .... during installation.
Those files are part of your setup schema and for the installation itself, it does not make much sense to remove them.

By the way, if you use the following code sample, I think that should work(after Apply Install Call);

Apply Install (get result into variable SUCCESS)
if Variable SUCCESS Equals COMPLETE
Set Variable NATIVE_ENGINE to TRUE
Delete Files \ (when installing)
Set Variable NATIVE_ENGINE to TRUE
end

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

mikKummerfeld
Posts: 252
Joined: Sat Dec 03, 2011 3:07 am
Location: Konstanz, Germany
Contact:

Re: Delete files not working

Postby mikKummerfeld » Mon Apr 16, 2012 9:45 am

Yes it does make sense if you know our very complex BI software. We have about 20 different installation modes...

I will try and give a feedback

Thanks
Kind regards

Heiko Kummerfeld
MIK GmbH

Setup developer for .NET BI Software (12 products)
Head of quality assurance
technical consultant

mikKummerfeld
Posts: 252
Joined: Sat Dec 03, 2011 3:07 am
Location: Konstanz, Germany
Contact:

Re: Delete files not working

Postby mikKummerfeld » Mon Apr 16, 2012 10:15 am

It does work, BUT in my target directory I have now all translation.* files and mtranslator.exe...why?
Kind regards

Heiko Kummerfeld
MIK GmbH

Setup developer for .NET BI Software (12 products)
Head of quality assurance
technical consultant

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

Re: Delete files not working

Postby FrancescoT » Mon Apr 16, 2012 10:55 am

Dear Heiko,

I am quite sure that this have nothing to do with the delete files command.

Please carefully check your install script ... probably you have erroneously added those.

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

mikKummerfeld
Posts: 252
Joined: Sat Dec 03, 2011 3:07 am
Location: Konstanz, Germany
Contact:

Re: Delete files not working

Postby mikKummerfeld » Tue Apr 17, 2012 12:27 am

NOT OK:

Apply Install (get result into variable SUCCESS)
if Variable SUCCESS Equals COMPLETE
Set Variable NATIVE_ENGINE to TRUE
Delete Files \ (when installing)
Set Variable NATIVE_ENGINE to TRUE
end

OK:

Apply Install (get result into variable SUCCESS)
if Variable SUCCESS Equals COMPLETE
Set Variable NATIVE_ENGINE to TRUE
Delete Files \ (when installing)
Set Variable NATIVE_ENGINE to FALSE
end

BTW: How can I delete a folder on the machine while installing ?
Kind regards

Heiko Kummerfeld
MIK GmbH

Setup developer for .NET BI Software (12 products)
Head of quality assurance
technical consultant

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

Re: Delete files not working

Postby FrancescoT » Tue Apr 17, 2012 9:03 am

Dear Heiko,

You are absolutely right!

Was a Copy & Paste Error ... my fault!

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

mikKummerfeld
Posts: 252
Joined: Sat Dec 03, 2011 3:07 am
Location: Konstanz, Germany
Contact:

Re: Delete files not working

Postby mikKummerfeld » Tue Apr 17, 2012 9:27 am

BTW: How can I delete a folder on the machine while installing ?
Kind regards

Heiko Kummerfeld
MIK GmbH

Setup developer for .NET BI Software (12 products)
Head of quality assurance
technical consultant

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

Re: Delete files not working

Postby FrancescoT » Wed Apr 18, 2012 3:56 am

Dear Heiko,

you can use:

- Call DLL Function on the RemoveDirectoryA WinAPI call in kernel32.dll (if the folder it is empty)
- Call Delete Files Recursive first if the folder is not empty.

The code snipped could be for example:

Set Variable MYPATH to f:\test
Set Variable PATH_EXIST to FALSE

Does Folder Exist $MYPATH$ (get result into variable PATH_EXIST)
if Variable PATH_EXIST Equals TRUE
Recursively Delete Files $MYPAT$
Call DLL Function kernel32.dll->RemoveDirectoryA
end

For your convenience, this is the usable code (just copy and past in you script):

Code: Select all

~InstallAware Clipboard Data~
~End~
~{1BD415C6-5343-424F-8081-27710A0F67A3}~
~Call DLL Function~
~{451AB20B-CBBA-48EC-8B27-027C2AD63C44}~
~kernel32.dll,RemoveDirectoryA,bool,,"pointer to string",$MYPATH$,$~
~mIDEFunc.dll\mEXEFunc.dll~
~Delete Files Recursive~
~{806C5DF1-3385-409D-967A-1915FAC0EFAC}~
~$MYPAT$~
~If~
~{DD5C8AD5-A691-4FA7-8926-843551088D16}~
~PATH_EXIST~
~0~
~TRUE~
~FALSE~
~Does File/Folder Exist~
~{6F52B2D3-F299-48B7-87CE-0B46399BED2D}~
~PATH_EXIST~
~$MYPATH$~
~FALSE~
~Comment~
~{575FAFB3-CD85-4CD7-8553-1A3A9C951F07}~
~~
~Set Variable~
~{6F67F552-1D33-4BB4-BBD6-87EA0B1F7F98}~
~PATH_EXIST$MYAH$MYAH$FALSE~
~FALSE~
~Set Variable~
~{DB8A4E37-5C7B-47FD-AE4D-8511C9CE75CF}~
~MYPATH$MYAH$MYAH$FALSE~
~f:\test~


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

mikKummerfeld
Posts: 252
Joined: Sat Dec 03, 2011 3:07 am
Location: Konstanz, Germany
Contact:

Re: Delete files not working

Postby mikKummerfeld » Wed Apr 18, 2012 4:03 am

Delete Recursive Files does not work in the native_engine mode (like your snippet before).
I need it there..While Installing. I tried with *.* and without.
The folder has 2 subfolders and 20 files

This is my code

Set Variable NATIVE_ENGINE to TRUE
if Variable stdclient Contains (Ignore Case) true
Delete Files $COREDIR$\miksrv.exe (when installing)
Delete Files $COREDIR$\mikwo.exe (when installing)
Delete Files $COREDIR$\mikb.exe (when installing)
Delete Files $COREDIR$\MIK.olap_builder.chm (when installing)
Recursively Delete Files $COREDIR$\FOLDER
Recursively Delete Files $COREDIR$\FOLDER\*.*

end
Set Variable NATIVE_ENGINE to FALSE
Kind regards

Heiko Kummerfeld
MIK GmbH

Setup developer for .NET BI Software (12 products)
Head of quality assurance
technical consultant

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

Re: Delete files not working

Postby FrancescoT » Wed Apr 18, 2012 4:45 am

Dear Heiko,

just try to set NATIVE_ENGINE to FALSE before to call "Recursively Delete Files $COREDIR$\FOLDER" (after the last call to Delete Files Command).

I used NATIVE_ENGINE because Delete File Command it is a Windows Installer command.
Every Windows Installer command it is effectively executed only with a call to APPLY INSTALL.

Using NATIVE_ENGINE in this way you can temporarily swich OFF MSI functionality ... having care to set to ON again when you do not need anymore.
Please refer to NATIVE_ENGINE in InstallAware Documentation. (Press F1 in IA Ide)

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: Google [Bot] and 86 guests