Jump to content


This is a ready-only archive of the InstallSite Forum. You cannot post any new content here. / Dies ist ein Archiv des InstallSite Forums. Hier können keine neuen Beiträge veröffentlicht werden.
Photo

DeleteDir


2 replies to this topic

sylvaing

sylvaing
  • Members
  • 4 posts

Posted 20 September 2004 - 21:49

Hi,

I'm using Dev 8, InstallScript.

I have to delete, at the Uninstall, the company folder created under all the users Application Data folder and under "all users" folder.

I can delete the current user and the "all users" folder using
DeleteDir AppDataFolder and CommonAppDataFolder.

but how can i remove the folders for other users, is it possible using InstallScript ?

Thanks
Sylvain

Vijay123

Vijay123
  • Full Members
  • 3 posts

Posted 09 August 2010 - 15:49

QUOTE (sylvaing @ 2004-09-20 21:49)
Hi,

I'm using Dev 8, InstallScript.

I have to delete, at the Uninstall, the company folder created under all the users Application Data folder and under "all users" folder.

I can delete the current user and the "all users" folder using
DeleteDir AppDataFolder and CommonAppDataFolder.

but how can i remove the folders for other users, is it possible using InstallScript ?

Thanks
Sylvain

I too have similer kind of problem.

i am unable to remove the directory having contents with
DeleteDir("c:\\progrm files\\ ....\\xyz",ALLCONTENTS);

it is alway returning -1, here the OS is Windows VISTA, and the files are in ReadOnly mode

is anyone know the way how to delete files/directory in this case.

Thanks
-Vijay

Glytzhkof

Glytzhkof
  • Moderators
  • 1,447 posts

Posted 09 August 2010 - 19:40

Generally it is not recommended to perform such deletions. It's high risk in case an error in the script causes cascading deletions. It has happened before, and it will happen again. In addition data deployed to the user profile is normally considered "user data" and as such shouldn't be deleted in case the user installs the product again and wants to keep the data. Remember that a major upgrade is an uninstall under the hood. You certainly don't want to delete all user data during an upgrade - though there are ways to condition this so deletion only runs on a real uninstall.

In most cases you are told to do such deletions by your manager. Explaining about the risks involved and the concept of allowing a reinstall that preserves previous data is generally enough to allow you to treat this as a non-issue.

Sometimes errors in the user data causes problems for program operation. In my case I had to patch a bunch of GDI-leaking metafiles installed per user. Managers sometimes think this is a setup task to fix. It is not. A setup can never ensure to update data for all users. This task is best performed by the application on launch since you then have a proper per-user runtime environment (unless you do a "run as..." without loading the user profile for the user you will run as).

If you REALLY need to do this cleanup, you can schedule a small cleanup exe to run via ActiveSetup for each user logging onto the machine. You then write the ActiveSetup key during uninstall, and the cleanup will run when the user logs on. Remember to disable this if you reinstall the program wink.gif. Again, I like to keep it simple. You make it fancy and there is always something you don't consider.

Edited by Glytzhkof, 09 August 2010 - 19:41.

Regards
-Stein Åsmul