none
get directory anywere on windows server or local system on less amount of time RRS feed

  • Question

  • I want to search dir name anywhere on local or server in shortest amount of time,from any location I am first going to root location then searching all root drives then for each root drive I am searching particular directory using below code but it is taking too much time 

    using that input I am passing only dir name I need full path of that directory but script took more than 2-3 minutes to execute that I want to reduce smallest amount of time 

    #from any location first I am going to root on console

    $g=Get-location $y=split-path -Path $g -Resolve $a=Get-PSDrive -PSProvider FileSystem echo $a.root set-location $y foreach ($t in $a.root){ #$m=dir -r | where { $_ -is [System.IO.DirectoryInfo] } #here its fast but how to pass my dir name here $h=dir -r | where {$_.FullName -match "apps"} if($h){ break; } }


    • Moved by Bill_Stewart Wednesday, December 12, 2018 8:18 PM Unanswerable drive-by question
    Friday, August 24, 2018 8:32 PM

All replies

  • There is no way to speed up a linear search.

    Windows has a built in search engine. Just type the partial name in the search box and the results will be displayed in less than a second.


    \_(ツ)_/

    Friday, August 24, 2018 9:46 PM
  • Didn't try yet, but you can check Lucene

    Regards kvprasoon

    Monday, August 27, 2018 3:59 AM