Ref: displaying the time-duration/length (hh:mm:ss) see last/below.
Question #2 (in 3 parts):
part 1: Can this script be made to include the sub directories also? - DOS dir cmd uses the ‘/s’ switch include sub-directories
part 2: If not, can a script be modified to append data to an existing CSV file?
part 3: Can the script also report the file-path where the audio file is stored?
I have sub-folders that also contain MP3 files (which are called track 1, tract 2, etc.):
…\Dos.Mundos.Audio.Activity.1of8
…\Dos.Mundos.Audio.Activity.2of8
…\Dos.Mundos.Audio.Activity.3of8
…\Dos.Mundos.Audio.Activity.4of8
…\Dos.Mundos.Audio.Activity.5of8
…\Dos.Mundos.Audio.Activity.6of8
…\Dos.Mundos.Audio.Activity.7of8
…\Dos.Mundos.Audio.Activity.8of8
Thanks, Tracey
Windows7 Powershell 5.1
Question #1 was about using code page 1252
$MediaFiles = @('*.mp3','*.mp4')
$Directory = 'D:\Users\Public\Public.Language\Pronounce it Perfectly in Spanish 2e\Pronounce it Perfectly in Spanish 2e.Down.Load'
$Shell = New-Object -ComObject Shell.Application
Get-ChildItem -Path $Directory -Recurse -Include $MediaFiles |
ForEach-Object {
$Folder = $Shell.Namespace($_.DirectoryName)
$File = $Folder.ParseName($_.Name)
$Duration = $Folder.GetDetailsOf($File, 27)
[PSCustomObject] @{
Name = $_.Name
Size = $_.length
Duration = $Duration
}
} | Export-Csv -Path 'C:\Users\Acer\MediaSE.csv' -NoTypeInformation