cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
dinesh_redhawk
Level 6

Delete(FilePath\*.*) not working

Hello Friends,

I want to delete all the files (irrespective of the names or types) in a folder.
Delete(FilePath\*.*) not working. It returns the error - file not found.
whereas the files are present in the folder.

Any help how can i delete all the files inside the folder.
[NOTE: I DONT WANT TO DELETE ANY SUB DIRECTORIES INSIDE THE FOLDER, JUST THE FILES]

Thanks
Labels (1)
0 Kudos
(7) Replies
chad_petersen
Level 9

Have you considered using the RemoveFiles table? I always try to use native MSI capabilities whenever possible, and only extend using Custom Actions if there is no other good way.

I assume someone wrote this Delete function. It doesn't seem to be one that is built in to InstallScript language as far as I can tell.

There is a DeleteFile built in that I can see. Even here, Flexera recommends using the RemoveFiles table if possible.

Project: In a Basic MSI or InstallScript MSI project, this functionality might be better achieved by using the native Windows Installer RemoveFiles action. For more information, see the Windows Installer Help.

http://helpnet.installshield.com/installshield22helplib/Subsystems/installshield22langref/helplibrary/LangrefDeleteFile.htm

Chad
0 Kudos
dinesh_redhawk
Level 6

chad.petersen wrote:
Have you considered using the RemoveFiles table? I always try to use native MSI capabilities whenever possible, and only extend using Custom Actions if there is no other good way.

I assume someone wrote this Delete function. It doesn't seem to be one that is built in to InstallScript language as far as I can tell.

There is a DeleteFile built in that I can see. Even here, Flexera recommends using the RemoveFiles table if possible.

Project: In a Basic MSI or InstallScript MSI project, this functionality might be better achieved by using the native Windows Installer RemoveFiles action. For more information, see the Windows Installer Help.

http://helpnet.installshield.com/installshield22helplib/Subsystems/installshield22langref/helplibrary/LangrefDeleteFile.htm

Chad


Hi, Thanks for the response
I cannot use the Remove file table as i dont know the file names or types as there could be any no. of files of any name or type.
Yes, i am using the inbuilt Delete file method.
0 Kudos
chad_petersen
Level 9

You should be able to use *.* in the RemoveFiles table. Have you tried that? I use it and it seems to do exactly what one would expect.

Chad
0 Kudos
dinesh_redhawk
Level 6

chad.petersen wrote:
You should be able to use *.* in the RemoveFiles table. Have you tried that? I use it and it seems to do exactly what one would expect.

Chad


Thanks, i didnt knew about that. BUT its a suite installer and it doesnt have a RemoveFiles table. 🙂
0 Kudos
chad_petersen
Level 9

It would be nice if you told us what you were working with from the beginning. What a waste of my time.

Chad
0 Kudos
MattQVI
Level 8

An entry in RemoveFiles requires a Component to be selected. Does that mean I need to create an entry for every single component? Anyway, I tried using the main install component in my entry. Tried to do delete *.* in the INSTALLDIR on uninstall but nothing seems to happen.

So I tried making a CA that occurs after RemoveFiles and I was able to successfully remove the subfolders that are preventing me from removing files from INSTALLDIR. I think the InstallExec Sequence is incorrect though - there still are several files left in the installation directory.
0 Kudos
gbaltazar
Level 6

Try DeleteFile(szPath ^ "*.*");
0 Kudos