How can an array of files, as found through tree
, be populated?
posh>
posh> tree ./ | Get-Item
Directory: /home/nicholas/powershell
Mode LastWriteTime Length Name
---- ------------- ------ ----
d---- 2/21/2021 5:42 PM regex
Get-Item: Cannot find path '/home/nicholas/powershell/regex/├── a.log' because it does not exist.
..
Get-Item: Cannot bind argument to parameter 'Path' because it is an empty string.
Get-Item: Cannot find path '/home/nicholas/powershell/regex/0 directories, 16 files' because it does not exist.
posh>
This example has no sub-directories, but for more complex directories, with sub-directories, looking to capture, for each file, its full path and filename.
Specifically, to then search the files -- but the question is of a somewhat general nature.
see also: