Windows 7 Forums
Welcome to Windows 7 Forums. Our forum is dedicated to helping you find support and solutions for any problems regarding your Windows 7 PC be it Dell, HP, Acer, Asus or a custom build. We also provide an extensive Windows 7 tutorial section that covers a wide range of tips and tricks.


Windows 7: More on search hell

22 Nov 2010   #1
gilmoses

Windows 7 Professional 64 bit
 
 
More on search hell

Hi,

I'm back with another frustrating search problem:
How to find a file by a string in the middle of the filename?

E.g. I'm searching for files with "Persist" in their name, in C:\Windows:

filename:Persist

10 items are found, but not this one:
"CbsPersist_20101012145040.cab" (in my C:\Windows\Logs)

That's because "Persist" does not start the filename, and is not after a dot or a hyphen.
I've tried looking in the advanced syntax for search but to no avail.

This is of course an example, I have dozens of log files with a similar naming convention (capital letter for each word start, LikeThisForExample) from which I must find a file.

Please help,

Thanks,
Gil.


My System SpecsSystem Spec
.
22 Nov 2010   #2
Anak

Microsoft Community Contributor Award Recipient

Win 7 Home Premium 64bit Ver 6.1.7600 Build 7601 - SP1
 
 

Hi! gilmoses, welcome to W7F

Just off the top of my head, have you tried *Persist* or %Persist%
My System SpecsSystem Spec
22 Nov 2010   #3
gilmoses

Windows 7 Professional 64 bit
 
 

Hi Anak,

Ok, *Persist* found the file. However this is the only way to find it and Windows Help doesn't tell you the file won't be found otherwise.

Thanks for that!

Gil.
My System SpecsSystem Spec
.

22 Nov 2010   #4
Dzomlija

Windows 7 Ultimate x64
 
 

Quote   Quote: Originally Posted by gilmoses View Post
Hi,

I'm back with another frustrating search problem:
How to find a file by a string in the middle of the filename?

E.g. I'm searching for files with "Persist" in their name, in C:\Windows:

filename:Persist

10 items are found, but not this one:
"CbsPersist_20101012145040.cab" (in my C:\Windows\Logs)

That's because "Persist" does not start the filename, and is not after a dot or a hyphen.
I've tried looking in the advanced syntax for search but to no avail.

This is of course an example, I have dozens of log files with a similar naming convention (capital letter for each word start, LikeThisForExample) from which I must find a file.

Please help,

Thanks,
Gil.
You can't find those files, because by default the "C:\Windows" folder, and all it's subfolders, are not included in the search index.

I did a quick test to verify that I had files with "persist" in the filename:
More on search hell-image1.jpg

But as you can see, a search in Windows found nothing:
More on search hell-image2.jpg

As stated, this is because "C:\Windows" is excluded from the index:
More on search hell-image3.jpg

So if you absolutely must find such files, but are not willing to add "C:\Windows" to the index, try this:

More on search hell-image4.jpg
  1. Open Windows Explorer, and navigate to "C:\Windows"
  2. Make sure that there are no files selected.
  3. Hold down the <SHIFT> key, and right-click an empty part of the list (anything not containing an icon)
  4. Click the "Open command window here" option
  5. A Command Prompt should open to "C:\Windows"
  6. If you only want to search the LOGS folders, type "CD Logs" (without quotes) and press <ENTER>
  7. Type "dir *persist*.* /a /s /p" (without the quotes) and press <ENTER>.
For more information on the parameters of DIR, type "DIR /?" (without quotes) and press <ENTER>

Code:
 
C:\Windows\Logs>dir *persist*.* /a /s /p
 Volume in drive C is Windows 7 Ultimate x64
 Volume Serial Number is 365F-53AD
 Directory of C:\Windows\Logs\CBS
08/08/2010  16:32           780,937 CbsPersist_20100808161414.cab
06/10/2010  06:12           612,423 CbsPersist_20101006220117.cab
               2 File(s)      1,393,360 bytes
     Total Files Listed:
               2 File(s)      1,393,360 bytes
               0 Dir(s)  25,829,761,024 bytes free
C:\Windows\Logs>dir *persist*.* /a /s /p /b
C:\Windows\Logs\CBS\CbsPersist_20100808161414.cab
C:\Windows\Logs\CBS\CbsPersist_20101006220117.cab
C:\Windows\Logs>


My System SpecsSystem Spec
22 Nov 2010   #5
Anak

Microsoft Community Contributor Award Recipient

Win 7 Home Premium 64bit Ver 6.1.7600 Build 7601 - SP1
 
 

Quote:
Find any one of differently named files
Code:
find . \( -name "*jsp" -o -name "*java" \) -type f -ls

The -ls option prints extended information, and the example finds any file whose name ends with either 'jsp' or 'java'. Note that the parentheses are required. Also note that the operator "or" can be abbreviated as "o". The "and" operator is assumed where no operator is given. In many shells the parentheses must be escaped with a backslash, "\(" and "\)", to prevent them from being interpreted as special shell characters. The -ls option and the -or operator are not available on all versions of find.
find - Wiki

Your word would have to be inserted where jsp and java are.
My System SpecsSystem Spec
22 Nov 2010   #6
gilmoses

Windows 7 Professional 64 bit
 
 

Dzomlija,
As Anak had pointed out, you WILL find the file if you specify filename:*persist*.

I don't think a folder must be indexed in order to find a file there - that would be ridiculous. The search will just be slower.

Gil.
My System SpecsSystem Spec
22 Nov 2010   #7
Anak

Microsoft Community Contributor Award Recipient

Win 7 Home Premium 64bit Ver 6.1.7600 Build 7601 - SP1
 
 

Peter, would the command line work even if the HDD was not Indexed?
My System SpecsSystem Spec
22 Nov 2010   #8
Dzomlija

Windows 7 Ultimate x64
 
 

Quote   Quote: Originally Posted by Anak View Post
Peter, would the command line work even if the HDD was not Indexed?
Yes, it would.
My System SpecsSystem Spec
22 Nov 2010   #9
Kari

 

Quote   Quote: Originally Posted by Anak View Post
Peter, would the command line work even if the HDD was not Indexed?
I'm not Peter but please allow me to answer: Yes.

BTW, there's two ways to use Windows search, searching index only and searching all locations.

When you search using Start Menu > Search field, you search indexed locations only. Searching from Explorer window's search field searches also non indexed locations from that location and downwards for instance searching in Explorer window for C:\Windows searches C:\Windows and all its subfolders, searching in My Computer window searches the whole computer, searching Explorer window for drive F: searches the whole drive F:.

Kari
My System SpecsSystem Spec
22 Nov 2010   #10
Dzomlija

Windows 7 Ultimate x64
 
 

Quote   Quote: Originally Posted by gilmoses View Post
Dzomlija,
As Anak had pointed out, you WILL find the file if you specify filename:*persist*.

I don't think a folder must be indexed in order to find a file there - that would be ridiculous. The search will just be slower.

Gil.
Sorry 'bout that, I'm a bit daft this morning [HITTING MYSELF ON THE HEAD], and should've remembered the wildcards.
My System SpecsSystem Spec
Reply

 More on search hell




Thread Tools




Similar help and support threads
Thread Forum
The quiz from hell
This is the quiz from hell Snow Isn?t Always White; In The Sierra Nevada Mountains Snow Is Sometimes? I am not going to say what I scored because it was pathetic:o
Chillout Room
Vpn hell
Hi there, Iíve been trying for weeks to establish a VPN connection and I keep getting the dreaded 800 error. Iím desperate; any help would be appreciatedÖ (1) Iím trying to establish an outgoing VPN connection from Computer A to Computer B (2) A is running Windows XP (3) ...
Network & Sharing
I'm going hell, I know it!
Just spent half a day getting rid of Vundo.H trojan on a PC at work. No virus scans run for 8+ months. IE temp folder took 3 minutes to empty. After a half dozen scans with NOD32, MalwareBytes, and MS MRT I stopped getting an infection warning. Had our outside gurus take it anyway and pull the HD...
Chillout Room
What the Hell is MS Doing?
I just read (on Winsupersite.com) that the pre order/upgrades will NOT have a clean install option. This is outrageous. Does MS have no clue as to the goodwill re Win 7 has garnered them but how something exactly like this could destroy that? I have personally suggested to @ least 50 people to...
General Discussion
Now what the hell have I've done
Win 7 E-mail messages import problem. Just replaced my small hard drive for a larger one. The small HD had Win 7 installed. Before replacing HD I backed up my e-mail messages that had been received and sent using Win Live Mail to a folder on an external HD. I checked that folder to make...
General Discussion
This is just one hell of a song~
Anyhow who doesn't laugh or like this song is weird. :( YouTube - Bloodhound Gang - The Bad Touch: MTV Version 2 e13RGx1zVV0
Chillout Room


Our Sites

Site Links

About Us

Find Us

Windows 7 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 7" and related materials are trademarks of Microsoft Corp.

© Designer Media Ltd

All times are GMT -5. The time now is 00:09.
Twitter Facebook Google+ Seven Forums iOS App Seven Forums Android App