Powershell Script to extract the name and duration of audio files .WAV, .MP3

This script will extract the name and duration of the .wav files in a given folder to a text file. You can change the .wav to .mp3 or other if needed!

# Name_and_duration_extractor.ps1
# This script will extract the name and duration of the .wav files in a give folder to a text file.
# You can change the .wav to .mp3 or other if needed
# Please change the folder paths as needed

$mediaPath = 'C:\User\Desktop\Media_Files\'

$scriptPath = 'C:\User\Desktop\name_and_duration_extractor.ps1'

$txtFilePath = 'C:\User\Desktop\Media_Files\name_and_duration_extractor_output.txt'

Get-ChildItem $mediaPath -Filter *.wav -name | Foreach-Object {
    $shell = New-Object -COMObject Shell.Application
    $shellfolder = $shell.Namespace($mediaPath)
    $shellfile = $shellfolder.ParseName($_)

    write-host $_ $shellfolder.GetDetailsOf($shellfile, 27);
}

$(. $scriptPath
) *>&1 > $txtFilePath


pause
Be Curiousish