Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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)

like image 732
Davinel Avatar asked Feb 04 '12 19:02

Davinel


1 Answers

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"
like image 131
David Heffernan Avatar answered Sep 25 '22 03:09

David Heffernan