WAV to MP3 mit Lame und Powershell

Aus MyWiki
Zur Navigation springen Zur Suche springen
$localpath = (get-location).path 
$output = "D:\hdd\mp3converted"
get-childitem -filter *.wav -Recurse | % {
   $NewPath = $_.Directory.Fullname -Replace [regex]::escape($localpath), $output
   $OutFile = $_.Fullname -Replace [regex]::escape($localpath), $output -Replace "\.wav",".mp3"
   if (-not (Test-Path $NewPath)) {New-Item -Path $NewPath -ItemType Directory }
   & D:\hdd\Programme\lame\lame.exe -V 0 -b 128 --priority 3 --tt $_.BaseName  --preset standard $_.Fullname $OutFile
}

Alle WAV Dateien unterhalb vom aktuellen Pfad werden konvertiert.
Der Pfad unterhalb wird dabei mit übernommen und der Teil vom aktuellen Pfad (also Start-Pfad) wird durch $output ersetzt
Bsp: Aktueller Pfad ist D:\HDD\Musik
"D:\HDD\Musik\Brass\Interpret1\Titel1.wav" wird zu "D:\HHD\mp3converted\Brass\Interpret1\Titel1.mp3"