Old 4th June 2010, 09:37   #1
wlmoate
Junior Member
 
Join Date: Dec 2008
Posts: 4
Post Delete Folder?

Hello,

I have used search and can not find an answer to my question, can someone help me? I have a sub folder within a folder and want to delete it along with any contents. I can delete files within a folder but not the folder itself

Here is my code

#Installs/Deletes files in specified directory------------------------------------------------------------------------------------------------------

Section -Main SEC0003
SetOutPath "$DOCUMENTS\Firmware\Phase 1"
Delete *.*
#SetOverwrite on
SectionEnd

#--------------------------------------------------------------------------------------

#Installs/Deletes files in specified directory------------------------------------------------------

Section -Main SEC0004
SetOutPath "$DOCUMENTS\Connect \Phase 2"
Delete 2.23
SetOverwrite on

SectionEnd

#-------------- 2.23 is one of the folders I want to delete.
wlmoate is offline   Reply With Quote
Old 4th June 2010, 09:44   #2
DrO
 
Join Date: Sep 2003
Posts: 27,873
check out the RMDir command.

-daz
DrO is offline   Reply With Quote
Old 4th June 2010, 09:53   #3
wlmoate
Junior Member
 
Join Date: Dec 2008
Posts: 4
Thanks for the quick reply.

So can you clarify if the following will work? and delete the folder 1.57 and its contents


Section -Main SEC0003
SetOutPath "$DOCUMENTS\Firmware\Phase 1\1.57"
RMDir /r $INSTDIR
#SetOverwrite on
SectionEnd

Thanks again
Wayne
wlmoate is offline   Reply With Quote
Old 4th June 2010, 12:04   #4
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
Don't use SetOutPath on it. You will lock the folder if you do that. Also never use RMDir /r on $INSTDIR in case the user has chosen C:\Windows for it (for example).

RMDir /r "$DOCUMENTS\Firmware\Phase 1\1.57"

Stu
Afrow UK is offline   Reply With Quote
Reply
Go Back   Winamp & Shoutcast Forums > Developer Center > NSIS Discussion

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump