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

java - Run spring boot application error: Cannot instantiate interface org.springframework.context.ApplicationListener -

reactjs - React router and this.props.children - how to pass state to this.props.children -

Excel VBA "Microsoft Windows Common Controls 6.0 (SP6)" Location Changes -