1

I am trying to use find to look for files that contain a specific keyword. To my understanding, find takes in a file not a directory (that's why it is giving me error). So is there a way i can go through each sub-directories and look into each and every file to execute the find command so that I can get the result of all files that contains the given keyword? (Much like grep)

So far i got this: find \S "keyword" "directory\ *"

Error i am getting:

Access denied - Directory name

Access denied - Directory name

. . .

Anyone give me a hint? I am current using window 7 right now.

Ryan Fung
  • 2,069
  • 9
  • 38
  • 60
  • For examples on how to do this with findstr, see http://stackoverflow.com/questions/9097034/findstr-ms-dos-command-wont-search-sub-directories. – Steven Apr 15 '16 at 19:10

1 Answers1

3

FIND does not take the /s switch (not \s - that's a directory)

FINDSTR is another animal.

About the only quibble about the documentation avaliable from findstr /? from the prompt is that you can target a filemask in a specified directory by specifying \dirname\*, not simply in the current directory as documented. There is also an option to run against a semicolon-delimiter list of directory names - but I've never seen it used.

Martijn Pieters
  • 1,048,767
  • 296
  • 4,058
  • 3,343
Magoo
  • 77,302
  • 8
  • 62
  • 84