Created
July 22, 2016 12:09
-
-
Save dnas2/9c632ef6468d5cef33464b57914d3c86 to your computer and use it in GitHub Desktop.
Powershell for exporting CSV of MP3 tracks in directory with length
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$resultsarray = @() | |
$shell = New-Object -COMObject Shell.Application | |
Get-ChildItem "[PATH HERE]" | | |
Foreach-Object { | |
$linkObject = new-object PSObject | |
$path = $_.FullName | |
$folder = Split-Path $path | |
$file = Split-Path $path -Leaf | |
$shellfolder = $shell.Namespace($folder) | |
$shellfile = $shellfolder.ParseName($file) | |
linkObject | add-member -membertype NoteProperty -name "File" -Value $file | |
linkObject | add-member -membertype NoteProperty -name "Length" -Value $shellfolder.GetDetailsOf($shellfile, 27) | |
$resultsarray += $linkObject | |
write-host """$($file)"", $($shellfolder.GetDetailsOf($shellfile, 27))"; | |
} | |
$resultsarray| Export-csv export.csv -notypeinformation |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment