I'm trying to de-duplicate a ton of files spread across many folders using PowerShell. While logging progress in a transcript, I'm trying to include the number of files held in an array (representing the batch of files being checked), but the output is expanding the array into its contained values (file names) instead of the number of objects it contains.
Tried:
$files = "file1.txt","file2.txt","file3.txt","file4.txt"
Write-Output "`tNumber of files: $files.length"
And get:
Number of files: file1.txt file2.txt file3.txt file4.txt
Then tried:
Write-Output "`tNumber of files: ",$files.length
and get:
Number of files:
4
Instead, I want:
Number of files: 4
I thought writing to a transcript had something to do with it but broke it down into it's simplest part. What am I missing?
Since PS version might matter...
PS > $psversiontable
Name Value
---- -----
PSVersion 5.1.17763.3770
PSEdition Desktop
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
BuildVersion 10.0.17763.3770
CLRVersion 4.0.30319.42000
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1