Search Files Recursively with Get-ChildItem
PowerShell one-liner to locate files by name in all subfolders, tolerating access-denied paths.
01Command
$ Get-ChildItem -Path "$env:USERPROFILE" -Recurse -Filter "*.txt" -ErrorAction SilentlyContinue02What it does
-Recurse makes the search descend all subdirectories, while -Filter applies a fast, provider-level filename pattern that is quicker than -Include for a single pattern. -ErrorAction SilentlyContinue suppresses the access-denied noise that recursing system folders always produces. Because the output is FileInfo objects, you can immediately pipe to Sort-Object Length or Where-Object LastWriteTime to narrow results further.
03Risk
04Undo
✓No undo needed — this command does not change persistent state.
05Sources
- Get-ChildItem (Microsoft.PowerShell.Management)Evidence: Documents Get-ChildItem with -Recurse for nested search, -Filter for provider-level filename patterns and -ErrorAction handling.
Last verified: 2026-09-17 · Category: Files & Folders
06Related solutions
Search inside text files and logs with regex, returning file, line number and match.
Diagnose NTFS file system errors and bad sectors on any volume — including the system drive while Windows is running — before committing to a repair.
Robocopy is Windows' built-in robust file copier: use /MIR to keep a destination folder as an exact one-way mirror of a source, resumable and restartable.