Archive: RmDir with wild cards


RmDir with wild cards
  I need to delete a number of directories which start off with similar names, for example I would like to delete all of the directories


C:MyProgramTool.dir.1.data

C
:MyProgramTool.dir.2.files
C:MyProgramTool.dir.3.plugins
C:MyProgramTool.dir.4.config
C:MyProgramTool.dir.5.data
C:MyProgramTool.dir.6.backup
C:MyProgramTool.dir.7.files
>
If I write

RmDir /r "C:\MyProgram\Tool.dir.*" 


nothing seems to happen, and the error flag doesn't seem to be set. Is there a quick and easy way to do this multiple deletion?

Don't think there's anything quick and easy, but you might be able to use this a starting point:

http://nsis.sourceforge.net/Delete_dirs_/_files_in_a_directory_except_one_dir_/_file


Actually this is quite easy...
  ... and of course I only realised on the way home from work!!!

You can't do it directly, but you can do it with only a few lines of code.

The example for the instruction "FindFirst" (section 4.9.5.9 of the docs) basically does what I need.

It finds files matching a given spec :D :D :D, and all I need to do is change the DetailPrint into a "RMDir /r" and prepend with the full pathname to the directory I am doing the "FindFirst" and "FindNext" in. :D :D :D