Festival stores voicepack data in the following example directory structure:
/usr/share/festival/voices/<language>/<voicepack name>
What is the simplest one-liner (preferably using ls
) to print out just the <voicepack name>
's, in all the potentially numerous <language>
subdirectories?
Best Answer
I'm on Fedora, and these voicepacks are in a slightly different location:
You can just modify this like so:
Using find
Using
ls
in this manor is typically frowned upon because the output ofls
is difficult to parse. Better to use thefind
command, like so:Details of find & basename
This command works by producing a list of full paths to files that are exactly 2 levels deep with respect to this directory:
This list looks like this:
But we want the last part of these directories, the leaf node. So we can make use of
basename
to parse it out:Putting it all together, we can make the
find
command pass each 2 level deep directory to thebasename
command. The notationbasename {}
is what is doing these basename conversions. Find calls it via it's-exec
switch.