delete folder function, only possible with vb-script ?

Got a problem you cannot solve? Try here.
emu99
Posts: 7
Joined: Sun Feb 18, 2007 7:08 am
Location: Germany / Duesseldorf

delete folder function, only possible with vb-script ?

Postby emu99 » Mon Feb 26, 2007 9:09 am

Hi,

is there a possibility to remove complete folders ?
I can't find a function for deleting folders... like "delete files".

E.g. I need to delete a folder inside folder SHORTCUTFILES after a installation created a folder with links.

Since we don't want programs to create their own shortcuts on the clients uf our users, because we use a central shortcuts on a fileserver for which users are each permitted by Acitve Directory-Group...

The Installation itself is executed inside the project with the run program function, since no msi-package available of JDK 5.02 EE.

@Installaware: could be something for next version / Designrequest
:)

Best Regards
Emu
Last edited by emu99 on Mon Feb 26, 2007 3:23 pm, edited 1 time in total.

emu99
Posts: 7
Joined: Sun Feb 18, 2007 7:08 am
Location: Germany / Duesseldorf

workaround with vbs

Postby emu99 » Mon Feb 26, 2007 10:33 am

i managed to create a workaround with a vbs which can take a parameter which holds the path + foldername and added the vbs under supportfiles...

so now i call run program with $WINSYSDIR$\\cscript.exe and parameter $SUPPORTDIR$\\removefolder.vbs $WINSYSDIR$test (as e.g. to delete folder test inside system32)

But i wonder why a such often used function like deletefolder is not inside the regular functions of installaware. Or I'm just blind and can't find it :-)

removefolder.vbs:

On Error Resume Next
Set objArgs = WScript.Arguments
Set WshShell = WScript.CreateObject("WScript.Shell")
Set fso = WScript.CreateObject("Scripting.FileSystemObject")

fldr = objArgs(0)

If fso.FolderExists(fldr) Then
fso.DeleteFolder fldr, True
End If

Set fso = Nothing
Set WshShell = Nothing
Set fso = Nothing

WScript.Quit(0)

dmostert2
Posts: 23
Joined: Fri May 11, 2007 6:09 am

Postby dmostert2 » Tue May 15, 2007 4:07 am

Yes - I agree with you. It shouldn't be so difficult to remove a folder's contents and afterwards the folder as well :?:


Cheers,
D.

davidda
Posts: 7
Joined: Sun May 13, 2007 9:59 am

Postby davidda » Tue May 15, 2007 9:10 am

It isn't difficult. :P

Just use the Run Program function to run cmd with the parameters /C "rd /S /Q "c:\\DirToDelete""

dmostert2
Posts: 23
Joined: Fri May 11, 2007 6:09 am

Postby dmostert2 » Tue May 15, 2007 12:45 pm

:P Very clever - but will this work on Vista and UAC?

D.

MichaelNesmith
Posts: 3452
Joined: Thu Dec 22, 2005 7:17 pm
Contact:

Postby MichaelNesmith » Tue May 15, 2007 1:54 pm

Delete Files Recursive, anyone?
Michael Nesmith
InstallAware
Home of The Next Generation MSI Installer
Get your free copy today - http://www.installaware.com/

davidda
Posts: 7
Joined: Sun May 13, 2007 9:59 am

Postby davidda » Tue May 15, 2007 2:18 pm

Michael i don't think this would help, because they don't want to only delete the files in the folder, but the folder itself.

I don't know if it works on Vista or UAC (what's that?), because i have none of them here.

MichaelNesmith
Posts: 3452
Joined: Thu Dec 22, 2005 7:17 pm
Contact:

Postby MichaelNesmith » Tue May 15, 2007 2:37 pm

Use Call DLL Function on RemoveDirectoryA in kernel32.dll if you want to remove a folder that is already empty.
Michael Nesmith

InstallAware

Home of The Next Generation MSI Installer

Get your free copy today - http://www.installaware.com/

JohnGalt
Posts: 58
Joined: Mon Sep 08, 2008 2:14 pm

Re: delete folder function, only possible with vb-script ?

Postby JohnGalt » Fri Sep 17, 2010 1:48 pm

There should be a script command for this. I know that Windows Installer does it, it's not hard there, so this is just an oversight! Please add this feature!

mills
Posts: 814
Joined: Tue Jul 06, 2010 7:10 pm
Location: Honolulu, HI

Re: delete folder function, only possible with vb-script ?

Postby mills » Fri Sep 17, 2010 7:34 pm

The request for this feature has been noted.

In the mean time, to delete a folder, you'll need to:

Delete the contents of the folder:
Recursively Delete Files $path$\folder

Delete the (empty) folder:
Call DLL Function kernel32.dll->RemoveDirectoryA
Andy Mills
InstallAware
Other Help:
White Papers (HowTos) - http://www.installaware.com/publication ... papers.htm
Product Guides - http://www.installaware.com/publication ... guides.htm
InstallAware Help - Press F1 in the InstallAware IDE.

ckaware
Posts: 125
Joined: Thu Mar 17, 2011 11:43 am

Re: delete folder function, only possible with vb-script ?

Postby ckaware » Thu Dec 01, 2011 1:00 pm

What's the status on this feature request? I uninstall my application and the TOMCAT folder left behind has a ton of EMPTY sub directories.

giaviv
Posts: 2039
Joined: Fri Dec 17, 2010 1:39 pm

Re: delete folder function, only possible with vb-script ?

Postby giaviv » Thu Dec 01, 2011 7:36 pm

Chris,

For now, please use the workaround above.
Aviv Giladi
InstallAware Software

White Papers (HowTos) - http://www.installaware.com/publication ... papers.htm
Product Guides - http://www.installaware.com/publication ... guides.htm
InstallAware Help -F1 anywhere in the InstallAware IDE

John Mc
Posts: 2
Joined: Tue Feb 14, 2012 6:44 pm

Re: delete folder function, only possible with vb-script ?

Postby John Mc » Tue Feb 14, 2012 6:53 pm

I appreciate the work around, but I'd like to check an alternate solution. Can you:

1) Recursively Delete Files "$path$\folder\*"
2) Recursively Delete Files "$path$\FileNameThatDoesNotExist.not"


Assumptions:
1) I want to delete all empty folders under $path$2) I'm confident that no files exist with the name given above


Thanks!

giaviv
Posts: 2039
Joined: Fri Dec 17, 2010 1:39 pm

Re: delete folder function, only possible with vb-script ?

Postby giaviv » Wed Feb 15, 2012 12:06 am

Hi,

How about you give it a try? Which version of IA are you using?
Aviv Giladi
InstallAware Software

White Papers (HowTos) - http://www.installaware.com/publication ... papers.htm
Product Guides - http://www.installaware.com/publication ... guides.htm
InstallAware Help -F1 anywhere in the InstallAware IDE

John Mc
Posts: 2
Joined: Tue Feb 14, 2012 6:44 pm

Re: delete folder function, only possible with vb-script ?

Postby John Mc » Wed Feb 15, 2012 12:53 pm

I tested it out and everything seemed to work fine. We'll see how things go in a more complex environment, but I'm happy enough to go with it.

I'm using IA 12 Studio on Win 7.

Thanks,


Return to “Technical Support”

Who is online

Users browsing this forum: Baidu [Spider] and 44 guests