Archive: Remove recusrively


Remove recusrively
Hi all,

I've a very short question for u. Could you please tell me how to delete files in subdiretories. I have something like,

\dir1\dir2\files ...
\dir1\dir3\files ...
\dir1\dir4\files ...

If i try Delete /r $INSDIR\dir1

Will it work (and remove files in dir1 also?)

Thanks and regards


No, Delete does not remove Directories. You would need to do something like this

# use *.* to delete all files in one dir,
# or you could delete each file
# individually, but why?

Delete "$INSTDIR\myAPP\*.*"

# This will delete all dir's, that are in
# the install dir.

RMDir /r "$INSTDIR"

btw, I am not sure if the enclosing Quotes are needed around $INSTDIR, if anyone knows for sure, i'd appreciate some feedback. I would think they are needed, if the Dir contains spaces, such as c:\program files\myAPP


Originally posted by SQwerl
[B]No, Delete does not remove Directories. You would need to do something like this
Delete "$INSTDIR\myAPP\*.*"

# This will delete all dir's, that are in
# the install dir.
When using this

DELETE "$INSTDIR\conf\*.*"
this will deletre all files in that directory but not the subdirectories !!!!
Hence If I have a directory called $INSTDIR\conf\xml\
Xml directory is not deleted and the files in this directory neither !!

So my questions is how to Clear a directory and its sub-direcotries (There are too much directories to clear them by hand)

File /r works for copy ....

Like SQwerl mentioned above: use

RMDir /r $INSTDIR\dir1
to delete dir1 and all its subdirectories.

Hope this helps -
Regards,
~ Florian

Originally posted by F. Heidenreich
Like SQwerl mentioned above: use
RMDir /r $INSTDIR\dir1
to delete dir1 and all its subdirectories.

Hope this helps -
Regards,
~ Florian
Thanks ;)

ahh, after rereading my original post, i see that i was a little confusing. sorry about that. :)


no problem