Find File Recursively in Powershell
To recursively search:
Get-ChildItem -Include cmake.exe -File -Recurse
the filter is in -Include
and can be a wildcard mask i.e. *cmake*
, cmake.???
etc.
Sample output:
alone@isb C:\ ❯❯❯ Get-ChildItem -Include cmake.exe -File -Recurse
Directory: C:\dev\vcpkg\downloads\tools\cmake-3.24.0-windows\cmake-3.24.0-windows-i386\bin
Mode LastWriteTime Length Name
---- ------------- ------ ----
-a--- 04/08/2022 15:09 8807048 cmake.exe
Directory: C:\Program Files\Microsoft Visual
Studio\2022\Community\Common7\IDE\CommonExtensions\Microsoft\CMake\CMake\bin
Mode LastWriteTime Length Name
---- ------------- ------ ----
-a--- 25/08/2022 17:59 10621376 cmake.exe
Wrap it in a function and add to profile:
function rsf($arg) {
Get-ChildItem -Include $arg -File -Recurse
}
Thanks! You can always email me or use contact form for more questions/comments etc.