Remove folders maching pattern recursively in Windows
rmdir /s
may be what you want to purge a sub-tree, and, as Floris said, this is very dangerous. If I understand your question correctly, you want to be able to delete myfolder\a\b\c\holiday_images
while leaving myfolder\a\b\c\holiday_videos
intact.
This should do what you want:
for /d /r %i in (*image*) do @rmdir /s "%i"
This is native Windows functionality; no need to download or install anything.
A bit of general advice for running potentially dangerous commands like this is to do
for /d /r %i in (*image*) do @echo rmdir /s "%i"first; that will show you what it will do, but not do anything. After you verify that it’s doing what you want, run it again without the
echo
.
If you want to use this command in a batch file (script), you must double the percent characters; i.e.,
for /d /r %%i in (*image*) do @rmdir /s "%%i"