This is slightly shorter:
gci *.wav | %{ ./lame -h -b 320 $_.Name "mp3/$($_.Name -replace
'\.wav$','.mp3')" }
Andrew Savinykh wrote:
> Assuming that you have lame.exe in the current directory and that you've
> already created the mp3 subfolder the following should work:
>
> gci *.wav | %{ $in = $_.Name; $out =
> [system.io.path]::ChangeExtension($in, "mp3"); ./lame -h -b 320 $in
> mp3/$out }
>
> //andrew
>
>
> Axolotl Q Cleaver wrote:
>> Although I've done much programming in the (distant) past I would
>> appreciate five minutes of someone's time to help me get started with
>> PowerShell.
>>
>> What I would like to do is pretty simple -
>> Process each file in a directory using lame to produce a mp3 as follows
>> lame -h -b 320 4RR_SYN69CD_track01.wav mp3\4RR_SYN69CD_track01.mp3
>>
>> I'm not sure whether to try to get all the filenames in the directory
>> and process them to produce a complete script to run against the
>> directory or whether to try to process the files one at a time - could
>> I do this starting with Get-ChildItem?
>>
>> Or am I looking at the wrong tool for the job?
>>
>> TIA - Martin