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

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.

1 Answer

This should work after moving to the top folder:

del /s foo.txt

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

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like