1

Converted all my CDs into flac (for storage) but made the mistake of using a long filename (Artist Name- Album Name - Song Title).

Sample filename: Jennifer Warnes - Famous Blue Raincoat - Ain't No Cure For Love.flac

Wanted to convert all the flac to mp3 (for mp3 player) using the following bash script. But first have to convert them to wav (before converting to mp3)

In bash ran :

for i in *.flac; do
  flac -d $i;
done

This simple script works on filename like famous_blue_raincoat.flac

However, due to space between the letters (and probably also the '), the scripts just wouldn't work on filenames like: Jennifer Warnes - Famous Blue Raincoat - Ain't No Cure For Love.flac

Any recommendations and advise welcomed.

4

1 に答える 1

3

You need quotes :

 for i in *.flac; do flac -d "$i"; done

This behaviour is called word splitting

于 2012-10-07T12:28:48.413 に答える