This website uses cookies. By clicking Accept, you consent to the use of cookies. Click Here to learn more about how we use cookies.
Turn on suggestions
Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.
- Revenera Community
- :
- InstallShield
- :
- InstallShield Forum
- :
- Removing Locked Directories on Uninstall
Subscribe
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Subscribe
- Mute
- Printer Friendly Page
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Mar 24, 2006
09:47 AM
Removing Locked Directories on Uninstall
During the uninstallation sequence, I have tried various ways to remove a directory and its subdirs; all methods fail because some files in the directory are locked -- the reason being, the uninstaller is running from there (so its files and the _jvm subdir files are locked).
This is what I've tried:
1) just let IS do it automatically - files go away, but not the main directory
2) remove dirs/files with FileService methods in a custom event bean - fails due to locking
3) used Java itself (oh no!) to remove the dirs/files via File.delete() - fails due to locking
4) used Java itself with File.deleteOnExit() - fails to due locking
The goal here is to remove the whole directory tree (and its parent if it is empty) for where the installer puts its files (and uninstaller).
Any help would be appreciated - I don't want empty directories left behind.
Thanks!
This is what I've tried:
1) just let IS do it automatically - files go away, but not the main directory
2) remove dirs/files with FileService methods in a custom event bean - fails due to locking
3) used Java itself (oh no!) to remove the dirs/files via File.delete() - fails due to locking
4) used Java itself with File.deleteOnExit() - fails to due locking
The goal here is to remove the whole directory tree (and its parent if it is empty) for where the installer puts its files (and uninstaller).
Any help would be appreciated - I don't want empty directories left behind.
Thanks!
(4) Replies
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Mar 24, 2006
09:49 AM
oh yeah; when I use the FileService, it forces the uninstall to prompt the user to reboot (not required before) to complete the install - not good. However, even after rebooting, those directories still remain!
Thanks!
Thanks!
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎May 18, 2006
06:49 AM
Hi,
did you figured it out?
I have the same problem.
Thank you
did you figured it out?
I have the same problem.
Thank you
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎May 18, 2006
08:36 AM
I did not figure it out so much as I was forced to do a "work around" where I kicked off a batch file (and did not "wait" for it to complete/return) at the end of the install that "slept" for a few seconds and then used the rmidr DOS command to remove the directory structure. It worked because the uninstaller was no longer running (locking the dir) by the time that the rmdir command was executed. Ugly, but effective.
I tried so many other things!!!
Good luck.
I tried so many other things!!!
Good luck.
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎May 19, 2006
11:15 AM
You could also use JNI code to manually schedule the directory for deletion on reboot via the MoveFileEx Win32 api call (MSDN Link.) Note: This means setting a move to destination NULL with the MOVEFILE_DELAY_UNTIL_REBOOT flag set.