Tag Archives: forfiles

Find files using forfiles in windows

Few days back I had to accomplish yet another task, finding some files among large data.

The problem was internal windows search function was very slow and it requires indexing (Which we disabled to save resources on server). In linux you can use find command to find the files you are looking for by using following command

find /opt/data -name "*.c"

This will find all the files with c extension under /opt/data directory on Linux. But unfortunately I was on windows and had to improvise. So I remember forfiles utility and used it to find files under D:\data directory on windows using following syntex.

forfiles /P d:\data /M *.c /S /C "cmd /c echo @path

I am sharing this syntex so that it might help somebody.

Please comment your views so that I can also learn a trick or two ;)