4

I need to delete all folders in "tomin" folder, which name contains terminates with the ".delme" string. The deletion need to be done recurively: I mean on all directory and SUB directories.

I though to do this:

FOR /R tomin %%X IN (*.delme) DO (RD /S /Q "%%X") 

but it does not work, I think /R ignores wildcards.

Before asking this question I searched also in SO and found this: but the answers did not help me in solving my issue, following the suggestion given there I tried:

FOR /F tomin "delims=" %%X IN ('dir /b /ad *.delme') DO RD /S /Q "%%X" 

But it did not work either.

2
  • Can you please post your full code to delete files. I am totally new to batch files. and I wan to delete all folder named as ".sass-cache" with all it's containts from all subfolders. Commented Nov 5, 2014 at 7:02
  • @SaurabhBayani: FOR /D /R yourfolder %%X IN .sass-cache DO RD /S /Q "%%X" Deletes all files and folders that finds into yourfolder and named .sass-cache Commented Nov 24, 2014 at 19:04

1 Answer 1

13

Your first command would work, but you forgot the /D to specify that you want directories.

FOR /D /R tomin %%X IN (*.delme) DO RD /S /Q "%%X"

Should do the trick.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.