May 03, 2024, 05:54:25 PM

News:

IonicWind Snippit Manager 2.xx Released!  Install it on a memory stick and take it with you!  With or without IWBasic!


Deleting an empty folder

Started by Andy, January 07, 2015, 05:43:27 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Andy

Hi Everyone,

I asked some time ago how to get a program to delete itself on exit, and this was the answer:
http://www.ionicwind.com/forums/index.php?topic=4580.0

But once the program is deleted, if the folder is empty, how can the folder itself be deleted?

Basically, I have a folder with several .exe and other files in it.
Once my uninstall.exe program deletes the other files, it deletes itself from the folder, but the folder itself is left and empty.

Any ideas how I can do this in IWB?

Not desperate on this, but the perfectionist in me would just like to tidy up after uninstalling my programs.

Thanks,
Andy.
Day after day, day after day, we struck nor breath nor motion, as idle as a painted ship upon a painted ocean.

billhsln

Not sure this will help, but might be worth a try.  Is there a ShellExecute which could run a batch script from the folder below the one you want do delete, which would delete the folder you want to delete and then delete itself.

Like:

RD MyDir
DEL MyBat.BAT

Just a thought,
Bill
When all else fails, get a bigger hammer.

Brian

Found this:

RMDIR c:\blah /s /q

If you wish you can use RD as an abbreviation for RMDIR. You don't get any prompts with this

Don't forget, you can't be inside the directory when you call this command

Brian

Andy

Thanks Bill and Brian,

Thanks for the suggestions!

The only thing I can think of is to have the uninstall.exe somewhere else, like the root directory, at least that way it will be able to delete
all the files in the folder, then remove the folder and delete itself from the root directory.

But will keep thinking about it.

Thanks,
Andy.
:)
Day after day, day after day, we struck nor breath nor motion, as idle as a painted ship upon a painted ocean.