Archive: Delete Folder?


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.


check out the RMDir command.

-daz


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


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