powershell - How do I get the length of file names longer than 250, then output the character count to a csv file? -
i've got this:
cmd /c dir /s /b |? {$_.length -gt 250}
however, export character count , file path 2 separate columns in csv file. adding
| export-csv ./250files.csv
does trick exporting count column, want path each file on second column.
export-csv
expecting objects convert csv. since dealing strings need make objects in order desired output. calculated properties you
cmd /c dir /s /b | select @{name="path";expression={$_}}, @{name="length";expression={$_.length}}
should able pipe next step easy.
Comments
Post a Comment