Page 1 of 1

Delete files not working

Posted: Fri Apr 13, 2012 3:06 am
by mikKummerfeld
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.

Re: Delete files not working

Posted: Fri Apr 13, 2012 8:30 am
by FrancescoT
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

Re: Delete files not working

Posted: Sun Apr 15, 2012 11:47 pm
by mikKummerfeld
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.

Re: Delete files not working

Posted: Mon Apr 16, 2012 9:16 am
by FrancescoT
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

Re: Delete files not working

Posted: Mon Apr 16, 2012 9:45 am
by mikKummerfeld
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

Re: Delete files not working

Posted: Mon Apr 16, 2012 10:15 am
by mikKummerfeld
It does work, BUT in my target directory I have now all translation.* files and mtranslator.exe...why?

Re: Delete files not working

Posted: Mon Apr 16, 2012 10:55 am
by FrancescoT
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

Re: Delete files not working

Posted: Tue Apr 17, 2012 12:27 am
by mikKummerfeld
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 ?

Re: Delete files not working

Posted: Tue Apr 17, 2012 9:03 am
by FrancescoT
Dear Heiko,

You are absolutely right!

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

Regards

Re: Delete files not working

Posted: Tue Apr 17, 2012 9:27 am
by mikKummerfeld
BTW: How can I delete a folder on the machine while installing ?

Re: Delete files not working

Posted: Wed Apr 18, 2012 3:56 am
by FrancescoT
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

Re: Delete files not working

Posted: Wed Apr 18, 2012 4:03 am
by mikKummerfeld
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

Re: Delete files not working

Posted: Wed Apr 18, 2012 4:45 am
by FrancescoT
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