Windows – bat function to find a file in folder and subfolders and do something with it.

batch-filebatch-processingfindwindows

I need to find all files with specific filename(for example main.css) in folder and all subfolders and then do something with it(eg. rename, move, delete, add text line, etc)

Best Answer

This is what you need:

for /R %f in (main.css) do @echo "%f"

Naturally you would replace echo with whatever it is you wish to do to the file. You can use wildcards if you need to:

for /R %f in (*.css) do @echo "%f"