Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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

1 Answer 1

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

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.