On Sat, 14 Jul 2007, Jordan Peacock wrote: > Working on a script so I can select multiple folders containing flac > files, and have them automatically encode the flac files to .mp3 V0 for > my brother's ipod. I'm close to having things working, just missing this > last bit. > > Where it says "lame -V 0" it wants two parameters: source file and > destination file. Unfortunately, that is singular, and it doesn't seem > to like the wildcard in destinations. Any ideas for alternatives? I'm > not a programmer, but I've stumbled through some programs. > > Here's the code as it stands (untested bits commented out). > > #!/bin/bash > IFS=" > " > for i in $NAUTILUS_SCRIPT_SELECTED_FILE_PATHS > do > if [ -d "$i" ] > then > cd "$i" > flac -d *.flac > lame -V 0 *.wav *.mp3 > # rm -f *.wav > # cd .. > fi > done I think you need an internal for loop like so: #!/bin/bash IFS=" " for i in $NAUTILUS_SCRIPT_SELECTED_FILE_PATHS do if [ -d "$i" ] then cd "$i" for file in `\ls -` *.flac | perl -pe 's/^(.*)\.flac$/$1/'` ; do flac -d "${file}.flac" lame -V 0 "${file}.wav" "${file}.mp3" # rm -f "${file}.wav" # cd - done fi done The perl bit is just taking the .flac extension off of the filename so that you can use the rest of the file name with .wav, .mp3, or whatever. Mike