Search for word within files in a folder.

bfuchs
bfuchs used Ask the Experts™
on
Hi Experts,
What is the easiest way to search for a word within the contents of files in a specific folder, including sub folders?
Would prefer not to install software or change pc settings, as this is needed for a one time only.
Thanks
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
NVITEnd-user support

Commented:
Using Windows Explorer search at upper right corner.

content:"text to find" *.xls

Open in new window

hi,
where should I use it, in cmd prompt? what exactly is the syntax?
just to clarify,  I'm not searching for file names, just for wording inside the files.
Thanks,
Ben
NVITEnd-user support

Commented:
Windows Explorer
Build an E-Commerce Site with Angular 5

Learn how to build an E-Commerce site with Angular 5, a JavaScript framework used by developers to build web, desktop, and mobile applications.

I entered the following, nothing showed up.
"0AB94000".php
also tried
content:"0AB94000" *.php
Same thing.
Thanks,
Ben
JohnBusiness Consultant (Owner)
Most Valuable Expert 2012
Expert of the Year 2018

Commented:
See below (in addition to the above good posts).   Try just 0AB94000.php

Windows Search
@John,
See below.
1Thanks,
Ben
ZeropointNRGHedge Fund Manager

Commented:
turn on indexing?
JohnBusiness Consultant (Owner)
Most Valuable Expert 2012
Expert of the Year 2018

Commented:
You need to navigate to the folder and then search from there. I think that might be your issue
ZeropointNRGHedge Fund Manager

Commented:
Lose the .php.
@John,
I'm searching from there, see image "search in staff" where staff is my folder.
@ZeropointNRG,
Any side effects from this?
How do I do it?
Thanks,
Ben
ZeropointNRGHedge Fund Manager

Commented:
Literally just click "Computer" and type in "0AB94000" in the search box and wait for it to search will take a while.
JohnBusiness Consultant (Owner)
Most Valuable Expert 2012
Expert of the Year 2018

Commented:
I'm searching from there, see image "search in staff" where staff is my folder.

Thanks. It did not look like that in your screen shot
JohnBusiness Consultant (Owner)
Most Valuable Expert 2012
Expert of the Year 2018

Commented:
It also looks like Windows 7, so as suggested make sure indexing is ON.
Literally just click "Computer" and type in "0AB94000" in the search box
This will search in all folders, any way to specify?

so as suggested make sure indexing is ON.
How?

Thanks,
Ben
ZeropointNRGHedge Fund Manager

Commented:
You can even just search all .php files and then in the list hover over any files and press the number 0.
JohnBusiness Consultant (Owner)
Most Valuable Expert 2012
Expert of the Year 2018

Commented:
Control Panel, Indexing Options.  Check there
You can even just search all .php
Actually I would prefer searching all file types, not only .php.
Thanks,
Ben
ZeropointNRGHedge Fund Manager

Commented:
Do you actually know where that file is? Turn on indexing in the control panel. Indexing options should be there.
JohnBusiness Consultant (Owner)
Most Valuable Expert 2012
Expert of the Year 2018

Commented:
Follow the top part if this article to make sure search (indexing is enabled)

https://www.thewindowsclub.com/fix-search-box-is-missing-in-windows-7-start-menu-explorer

If enabled you should be able to search for phrase.*
ZeropointNRGHedge Fund Manager

Commented:
Do you want to elaborate on exactly what you're trying to do?
1Don't see an option on/off.
Thanks,
Ben
ZeropointNRGHedge Fund Manager

Commented:
It's already on..
JohnBusiness Consultant (Owner)
Most Valuable Expert 2012
Expert of the Year 2018

Commented:
Navigate to c:\programdata\microsoft so that the right side of explorer shows you the contents of that folder. Then search from the top right as we suggested.

I just tried what I suggested above on my own machine and it works fine. So the method appears to be correct
c:\programdata
I have no such folder.

Thanks,
Ben
It's already on..
So why aren't any of those suggestions working?!

Thanks,
Ben
JohnBusiness Consultant (Owner)
Most Valuable Expert 2012
Expert of the Year 2018

Commented:
If that is true then your "current location" in indexing options is incorrect and that will cause you problems.
ZeropointNRGHedge Fund Manager

Commented:
If this file isn't local or it's locked or hidden or w/e and nobody can give you what you want. I know you said you don't want software, but since it's a one time thing, you can use this 30 day trial to search for it then just uninstall it. NFS Pro If you can't find it, it probably doesn't exist or you've got the file name wrong.
If that is true then your "current location" in indexing options is incorrect and that will cause you problems.
Perhaps this is the case here...how can I check that out, and what is the way to fix it?

Thanks,
Ben
If this file isn't local or it's locked or hidden
or you've got the file name wrong.
Its none of these.
I am testing with something that I know is there...

Thanks,
Ben
JohnBusiness Consultant (Owner)
Most Valuable Expert 2012
Expert of the Year 2018

Commented:
The folder selected should be there. Turn on Hidden Files in Windows Explorer options. Restart Explorer and check. That is my index location and the folder is there.  Check as per just above
The folder selected should be there. Turn on Hidden Files in Windows Explorer options.
Ok now its there, so how do I go further?
when searching for the word there it does not find.
asking me if want add this location to index, just say yes?

Thanks,
Ben
JohnBusiness Consultant (Owner)
Most Valuable Expert 2012
Expert of the Year 2018

Commented:
OK,  gone for the night.

Check your Explorer options for Hidden Files/Folders   and turn that on.  Then search should be working fine.
JohnBusiness Consultant (Owner)
Most Valuable Expert 2012
Expert of the Year 2018

Commented:
Ok now its there, so I do I go further?  when searching for the word there it does not find.  asking me if want add this location to index, just say yes?

Yes.    I will check in tomorrow
asking me if want add this location to index, just say yes?

Yes
Ok done that.
Now when going to the folder and entering 0AB94000 only some type of files come up, any idea why?

Thanks,
Ben
OMG ... a lot of suggestion for a thing that never worked well ..
the windows search it's the worst part of windows, totally crapware ....
after windows 98 i always disable the windows search and the indexing (that consume a lot of resource cpu+disk space) and always used "Agent Ransack". It can replace the F3 search on windows (hook on shell), it's fast, has regular expression, preview of the search, don't use preindex but it's really really fast !
give it a try .. it's free
https://www.mythicsoft.com/agentransack/download/

have a good day
NVITEnd-user support

Commented:
Windows Search works great here. No need for Agent Ransack
JohnBusiness Consultant (Owner)
Most Valuable Expert 2012
Expert of the Year 2018

Commented:
At this point, since most of the settings seem to be working, try rebuilding the index.

Go to Control Panel, Indexing Options, Advanced and click on Rebuild Index.

Now indexing will rebuild and it could take several hours.
JohnBusiness Consultant (Owner)
Most Valuable Expert 2012
Expert of the Year 2018

Commented:
Separately, Windows 7 is nearly dead and you need to move on to Windows 10.  Search in Windows 10 works very well.
Test your restores, not your backups...
Top Expert 2016
Commented:
Just to throw it out there (I have a love hate relationship with Windows Explorer search tool, but I index a large amount of email in Outlook and I think that throws it off its game).

Since this is a one time need, here's another approach.  Also. this will work best for true text type files, and less well for things like Word .DOC files, .PDF files, etc.

Given that, you can just do something like this from a DOS command line, and see what it gives you.  Since this is a one time need it might be enough.

findstr /s /i "0AB94000" c:\temp\*.php > results.txt

This will look for the content of "0AB94000" in all PHP files in c:\temp, and all subfolders.  It will place the results in "results.txt".

You can of course search all file types by doing:

findstr /s /i "0AB94000" c:\temp\*.* > results.txt

Also, other options are available for FINDSTR, do FINDSTR /? from a command prompt to get a summary of them.


»bp
@Bill,
Yours worked!!

@John,
Will test now Rebuild Index.

Now indexing will rebuild and it could take several hours.
During this time can I continue working on my pc, w/o any complications?

Thanks,
Ben
JohnBusiness Consultant (Owner)
Most Valuable Expert 2012
Expert of the Year 2018

Commented:
During this time can I continue working on my pc, w/o any complications?

Yes.   PC work may slow down re-indexing a bit but not seriously
ZeropointNRGHedge Fund Manager

Commented:
Oh you wanted to find text inside a file, not an actual file!  lol..Sorry about that ;)
Hi Experts,

After following all suggested (including rebuilding index) only Bill's suggestion seems to work at my pc...

Thanks for All!
Bill PrewTest your restores, not your backups...
Top Expert 2016

Commented:
Glad that helped.


»bp

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial