From powershell, ls -R *.txt
will list files recursively by directory, or, even better:
PS> Get-ChildItem -Path C:\Test -Name
logs
anotherfile.txt
Command.txt
CreateTestFile.ps1
ReadOnlyFile.txt
but how do I feed this into an array? I would like an array of the file (?) object itself, looking at:
Get-ChildItem "C:\WINDOWS\System32" *.txt -Recurse | Select-Object FullName
https://stackoverflow.com/a/24468733/262852
I'm looking for an array of "file" objects with powershell from these types of commands.
probably better syntax:
Copy-Item -Filter *.txt -Path c:\data -Recurse -Destination C:\temp\text
but rather than copy the items, I just want an object, or rather, array of objects. Not the path to a file, not the file, but, presumably, a powershell reference or pointer to a file.
(Reading the fine manual now.)