Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I need to search through a disk with lots of files for any documents (PDF, DOC, DOCX, XLS, etc.) that have a file name matching one or more of a couple hundred of words.

The built-in search tool is slow and doesn't work well with many search words. Does anyone know of a tool/program that can help?

share|improve this question
Install Powershell from microsoft. The task you want to perform is a few lines long script. single for loop changing match pattern for each iteration. – mnmnc Dec 19 '12 at 13:15
Thanks for the suggestion. I solved the problem based on your idea. – Petter Brodin Dec 20 '12 at 11:00
Good to know that. cheers. – mnmnc Dec 20 '12 at 11:08
up vote 0 down vote accepted

Based on the suggestion from mnmnc I made a Powershell script that seems to do the trick. It's slow, but it gives me the results I want.

$phrases = ("*Wildcard*,*separated*,*array*,*of*,*search*,*terms*")

Remove-Item .\results.txt

foreach ($p in $phrases){
    $results = @(Get-ChildItem -Recurse -Path 'E:\myPath\' -Filter "$m" | where{$_.Extension -match "doc|docx|pdf|txt|xls|xlsx"} | Select-Object Fullname)

    if($results.count -ne 0){
        $m + "      " + $results.length >> ".\results.txt"
        $results >> ".\results.txt"

        " >> ".\results.txt"

This loops through the phrases and sees if there are any files of the allowed extension that match the search phrase. The results are put into an array, and if the array has any elements the phrase, number of results, and file names are printed into a text file.

That foreach loop is probably terribly expensive and I wouldn't be surprised if there were a better way of doing it, but I'm just letting this run in the background, so I don't mind it taking a while.

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .