-
-
Save AlexandreRio/8559248 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
#License CC-BY-NC-SA for the code. | |
#This script converts all flac files in a directory into 320kpbs mp3 files, and then move them into another directory, | |
#set as the first argument. The occurences of words Flac and FLAC will be replace in the name of the working director.y | |
#considering wd is /path/nameOfDirectory-FLAC, the new directory will be $1/nameOfDirectory-mp3. | |
#Needs 1 parameter : the path to save the directory containing the mp3 files. | |
if [ $# -eq 1 ]; then | |
currentPath=`pwd` | |
currentFolder=${currentPath##*/} | |
destFolder=${currentFolder//FLAC|Flac/mp3} | |
for f in *.flac; do | |
ffmpeg -i "$f" -ab 320k "${f%.flac}.mp3"; | |
done | |
mkdir "$destFolder" | |
mv *.mp3 "$destFolder" | |
mv "$destFolder" $1 | |
else | |
echo -e "Usage: move to the directory with your flach files, then call\n\t./flacToMP3.sh dest_dir" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment