Date: Sun, 23 Mar 2014 13:59:54 +0100
From: clemens(a)ladisch.de
To: dj_kaza(a)hotmail.com
CC: linux-audio-user(a)lists.linuxaudio.org
Subject: Re: [LAU] Basic Bash/Find and batch CLI questions.
Kaza Kore wrote:
find ./ -type d -exec ~/bin/flac2mp3
"{}" \;
So find is passing all directories, via the type argument
The type argument is a filter.
Yep got that much. Filter for Directories.
find is not
actually being used for any searching, just to recursively send all folders, right?
The default action is to print what has been found.
But there is no search term. Therefore I take it it's an assumed -name *.* and passes
all directory paths (but no filenames) to the executed file.
With -exec, the specified program is executed for each
found item.
Each found item? So I could use [-type f -iname *.flac] and it would run through on each
file in turn? (Been meaning to test this out, which is what I was trying when I came
across the problem answered below. Not had a chance again yet. Obviously I'd have to
at least remove the [cd "${1}" && for f in *.flac; do] section but
replace it with what? Are programs such as ffmpeg and lame not designed to accept a list
of files? I thought many Linux programs were designed to accept exactly this as input...
I'll try and do some experimenting after dinner. At least if my headache goes a
bit...
I don't understand the bit after the exec
call
{} is the file name, ; ends the command to be executed.
Thanks. That's pretty much the conclusions I had come to. Although still need to read
up on bash again as how this then relates to $f etc still confused me a bit...
$ find -iname
*wey*
find: paths must precede expression: weyheyhey !! - Little Batty Foo Foo (ft.
TechDiff's Modest Loft Conversion remix).mp3
The shell expands *wey* into multiple arguments, but -iname expects only one.
It worked in the parent directory because *wey* could not be expanded there.
To prevent expansion, quote it:
$ find . -iname '*wey*'
Still not sure while it baulks with *wey* and not with *wan* but thanks both you and
James, using quotation marks cured that problem when testing earlier so all is good on
that front.
I do agree having a single call to the script and the search-term (find command) being
included in that would make sense, rather than having it called the method I currently am.
Pretty sure most CLI commands can be used in bash but again the small bits I once learn
have been lost to me currently, so more reading and testing needed!
And thanks other James, will look into mp3gain, it's also the first solution I found
with Google. I know the subject of RMS normalisation has come up on here a few times so
should probably spend some time searching the archives for this mail-list for that one
(part of the reason I felt a little cheeky asking but as I had other questions too... ;)
)
Dale.