bash/zsh vs. PowerShell find files


Unix shell find

find . -name '*ssl*'

PowerShell Get-ChildItem/gci

Get-ChildItem -Path . -Include '*ssl*' -Recurse
or
gci . -Include '*ssl*' -Recurse

Of course, this is a different format that’s made of string representations of objections from the gci call.

    Directory: C:\windows\INF


Mode                LastWriteTime         Length Name
----                -------------         ------ ----
-a----        9/15/2018  12:11 AM           1056 c_sslaccel.inf


    Directory: C:\windows\servicing\Packages


Mode                LastWriteTime         Length Name
----                -------------         ------ ----
-a----        9/14/2018   4:24 PM           9876 Microsoft-OneCore-LibreSSL-Package~31bf3856ad364e35~amd64~~10.0.17763.
                                                 1.cat
-a----        9/14/2018  11:30 AM           1170 Microsoft-OneCore-LibreSSL-Package~31bf3856ad364e35~amd64~~10.0.17763.
                                                 1.mum 

Selecting the object values

You can use Get-ChildItem | Get-Member (gci | gm) to see options for object values and you’ll see that one of the options under System.IO.FileInfo to be FullName, which you can use via Select-Object

TL;DR

Get-ChildItem -Path . -Include '*ssl*' -Recurse | Select-Object FullName

# or

gci . -Include '*ssl*' -Recurse | Select-Object FullName
,

Leave a Reply

%d bloggers like this: