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

Popular posts from this blog

How to check data type in C++? -

javascript - Is getTimezoneOffset() stable during daylight saving transition? -

sql server - SQL Query returns one result, does not return 0 or NULL result -