How to `rm dir/*/foo.txt` in Windows?

Posted on


I have a directory with several subdirectories inside and several files inside those. I want to delete all files with the name ‘foo.txt’ in those subdirectories.

So basically I want Linux’s rm dir/*/foo.txt, but del dir*foo.txt doesn’t do it.

Also, the subdirectories might contain space characters.


This should work after moving to the top folder:

del /s foo.txt

Enter del /? to see the rest of the options.

Leave a Reply

Your email address will not be published.