View Full Version : recursively delete all folders/files within my app's direcotory
chasetoys
4th May 2006, 08:23
I dynamically create folders and directories within my applciation's program file directory.l.
I'm using the automatic NSIS script, but as far as I know, it only deletes the directories which exist upon installation.
So if I dynamially create files & files & direcotries, how can I can ensure that these files/fodlers are deleted as well?
Thanks!
Afrow UK
4th May 2006, 08:41
If you want to delete the entire $INSTDIR, use RMDir /r $INSTDIR. The /r switch makes it recursive. However, this is generally a very bad idea as the user may install to the desktop or some other folder, and those files will be deleted as well.
-Stu
Red Wine
4th May 2006, 08:59
probably this thread (http://forums.winamp.com/showthread.php?s=&threadid=242991) has info of what you're looking, you may change the given example to remove directories as well :-)
chasetoys
5th May 2006, 22:22
If I force the user to install in the Program Files\MyApp directory (and not allow them to change the install directory upon installation), and I use the recursive call to delete all files from the $INSTDIR, wouldn't this be AOK?
Afrow UK
6th May 2006, 09:34
Yes. Perhaps you should have a MessageBox in your uninstaller though:
LangString ConfirmUninstall ${LANG_ENGLISH} "All existing \
files and folders under the $(^Name) installation directory \
will be removed.$\r$\nThis includes any files and folders \
that have since been added after the installation of \
$(^Name).$\r$\n$\r$\nAre you sure you wish to continue?"
...
MessageBox MB_OKCANCEL|MB_ICONINFORMATION $(ConfirmUninstall) IDOK +2
Abort
StrCpy $INSTDIR "$PROGRAMFILES\MyApp"
RMDir /r $INSTDIR
-Stu
vBulletin® v3.8.6, Copyright ©2000-2013, Jelsoft Enterprises Ltd.