locked
Inconsistent PowerShell results RRS feed

  • Question

  • Windows 10

    Created this power shell script

    Get-ChildItem -Path 'N:\ENIE\*gainr*' -Recurse | Out-File '.\search_gainr.txt'

    Ran it, required a couple of minutes to run, expected as there are many directories there, and found files I wanted.

    Created this script

    Get-ChildItem -Path 'N:\ENIE\*esir*' -Recurse | Out-File '.\search_esir.txt'

    Ran it, returned almost immediately, did not find any files.  But I know some exist.  Just to prove the point, I created a new file with phrase "esir" in the name.  Ran the script and it returned in maybe two seconds.  It did not find the new file.  Evidently it used a cached list of files. What steps can I take to instruct it to ignore all cached lists and go actually search all the subdirectories for the files I want?


    ~jag77 We need to know what a dragon is before we study its anatomy. (Bryan Kelly, 2010)

    Tuesday, November 21, 2017 4:45 AM

All replies

  • Get-ChildItem -Path 'N:\ENIE\*esir*' -Recurse -Force

    "Force" to find hidden files and folders.


    \_(ツ)_/

    • Proposed as answer by Jacorbello Tuesday, November 21, 2017 4:56 AM
    Tuesday, November 21, 2017 4:55 AM