Convert entire music library

lc() { od="$1"; nd="$2"; of=$3; nf=$4; cp -rl "$od" "$nd"; find $nd -type f -iname \*$of -print -execdir ffmpeg -i {} -loglevel error -q:a 6 {}.$nf \; -execdir rm {} +; find $nd -type f -iname \*.$of.$nf -execdir rename "s/$of.$nf/$nf/" {} +; }
Music Library Convert Usage lc Old_Directory New_DIrectory Old_Format New_Format lc ~/Music ~/Music_ogg mp3 ogg This will convert all audio files in the old directory to the new directory from the old format to the new format. It will leave the original library alone. The converted library will retain folder structure.

2015-12-16 20:16:01

What Others Think

Sharing with friends, I have applied very well, if you have time, you should refer to
Almahelen · 52 weeks and 6 days ago
I mean klingeltöne
Almahelen · 52 weeks and 6 days ago
any new recent updates with the forum??
Killersmile · 43 weeks and 3 days ago
I have another questions regarding how to automate bit rate base on the original file bit rate. Is it possible to program the target MP3 bit rate to max out at 320 for all files 16/44 and higher but when MP3 256 to use the lower bit rate? About half my library is 256 CBR so converting to 320 just increases the size, not quality. The remaining half is a mixture of CD rips 16/44 and HD downloads 24/96 and 24/192. Download mp3 ringtone on
celinaa123 · 25 weeks ago
That is a good article, besides you can also download ringtones for free at with the best quality available today.
sophia97 · 16 weeks and 4 days ago

What do you think?

Any thoughts on this command? Does it work on your machine? Can you do the same thing with only 14 characters?

You must be signed in to comment.

What's this? is the place to record those command-line gems that you return to again and again. That way others can gain from your CLI wisdom and you from theirs too. All commands can be commented on, discussed and voted up or down.

Share Your Commands

Stay in the loop…

Follow the Tweets.

Every new command is wrapped in a tweet and posted to Twitter. Following the stream is a great way of staying abreast of the latest commands. For the more discerning, there are Twitter accounts for commands that get a minimum of 3 and 10 votes - that way only the great commands get tweeted.


Subscribe to the feeds.

Use your favourite RSS aggregator to stay in touch with the latest commands. There are feeds mirroring the 3 Twitter streams as well as for virtually every other subset (users, tags, functions,…):

Subscribe to the feed for: