mp32mp3 shell script

Here is a small script to reduce the size of a mp3 file. I made it to put more music on my mp3 usb key ;)

#!/bin/bash
# This is not a script of my creation, I just added some things
# Tell me if you are the real author of this script
# Yoda-BZH tristan AT kerguz DOT fr
IFS="
"

function mp32mp3 () {
        mkdir old
        #echo $i
        mv "$i" old/
        # Change here the value
        lame -h -b 128 "old/$i" "$i"
}

# convert all mp3 files in directory

if [ $# -eq 1 -a -d "$1" ]; then

        for file in $1/*.[Mm][Pp][3]; do
                mp32mp3 "$file"
        done
        exit
 fi

# One or more mp3 files were given

for file in $*; do
        mp32mp3 "$file"
done

Haut de page