Monthly Archives: October 2010

File Name Search in PowerShell

Applies to: Microsoft PowerShell

Here a simple but effective command to retrieve a list of all files in a directory tree containing a specific text in the file name.

dir c:users -r -i “*yourtext*”

Explanation

  • The first argument is the directory to search (c:users).
  • Process all sub-directories with the –r switch.
  • The -i switch is used to specify which file names to search for, in this case all files containing yourtext