I'm having trouble with this piece of code:
22 for filename in "$( ls "$1" | grep ".*\.flac$" )"; do
23 file_path="$1${filename}"
24 ffmpeg -i "${file_path}" -f ffmetadata $HOME/metadata
Instead of a metadata file on each iteration, I'm getting this error message:
Downloads/Ariel Pink's Haunted Graffiti - Worn Copy (2005)/01 Trepanated Earth.flac ... 17 Jagged Carnival Tours.flac: File name too long
So it appears that inside the loop the $filename variable is equal the names of all FLAC files lumped together.
Of course, omitting quote marks on line 22 results in whitespace problems.
How do I make this work? I'm new to bash and very confused.
find
instead of your loop? – bsd Mar 14 '15 at 10:31