Ryan Fung
Ryan Fung

Reputation: 2217

find (ms-dos command) looking into sub directories files

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.

Upvotes: 2

Views: 11927

Answers (1)

Magoo
Magoo

Reputation: 80033

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.

Upvotes: 3

Related Questions