ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I have quite a few music files that I want to move from Win$lows to *nix but they have all been recorded in wma format.
I know how to convert the files from wma to mp3 however because there are quite a lot of files I would like to recursively convert the files, to do this though I will need to list all of the wma's and the directory they are in:
Code:
find . -iname *wma | sed -e 's/\/*\/*.wma//g'`
The command above kind of works but it prints the OP like this:
Code:
./music/Frank Sinatra/20 Classic Tracks/01 Come Fly With Me
./music/Frank Sinatra/20 Classic Tracks/18 Cheek to Cheek
./music/Frank Sinatra/20 Classic Tracks/04 Moonlight in Vermont
./music/Frank Sinatra/20 Classic Tracks/11 Come Dance With Me
./music/Frank Sinatra/20 Classic Tracks/13 Just in Time
./music/Frank Sinatra/20 Classic Tracks/05 Autumn in New York
./music/Frank Sinatra/20 Classic Tracks/09 London by Night
./music/Frank Sinatra/20 Classic Tracks/03 French Foreign Legion
./music/Frank Sinatra/20 Classic Tracks/19 Baubles, Bangles and Beads
./music/Frank Sinatra/20 Classic Tracks/12 Something's Gotta Give
./music/Frank Sinatra/20 Classic Tracks/15 Too Close for Comfort
./music/Frank Sinatra/20 Classic Tracks/16 I Could Have Danced All Night
./music/Frank Sinatra/20 Classic Tracks/14 Dancing in the Dark
./music/Frank Sinatra/20 Classic Tracks/08 Brazil
./music/Frank Sinatra/20 Classic Tracks/02 Around the World
./music/Frank Sinatra/20 Classic Tracks/06 Let's Get Away from It All
./music/Frank Sinatra/20 Classic Tracks/10 It's Nice to Go Trav'ling
./music/Frank Sinatra/20 Classic Tracks/20 Day In - Day Out
./music/Frank Sinatra/20 Classic Tracks/17 Saturday Night (Is the Loneliest Night of the Week)
./music/Frank Sinatra/20 Classic Tracks/07 April in Paris
I would like it to chop the whole filename off and just leave the dir that the files are in.
I have quite a few music files that I want to move from Win$lows to *nix but they have all been recorded in wma format.
I know how to convert the files from wma to mp3 however because there are quite a lot of files I would like to recursively convert the files, to do this though I will need to list all of the wma's and the directory they are in:
Code:
find . -iname *wma | sed -e 's/\/*\/*.wma//g'`
The command above kind of works but it prints the OP like this:
Code:
./music/Frank Sinatra/20 Classic Tracks/01 Come Fly With Me
./music/Frank Sinatra/20 Classic Tracks/18 Cheek to Cheek
./music/Frank Sinatra/20 Classic Tracks/04 Moonlight in Vermont
./music/Frank Sinatra/20 Classic Tracks/11 Come Dance With Me
./music/Frank Sinatra/20 Classic Tracks/13 Just in Time
./music/Frank Sinatra/20 Classic Tracks/05 Autumn in New York
./music/Frank Sinatra/20 Classic Tracks/09 London by Night
./music/Frank Sinatra/20 Classic Tracks/03 French Foreign Legion
./music/Frank Sinatra/20 Classic Tracks/19 Baubles, Bangles and Beads
./music/Frank Sinatra/20 Classic Tracks/12 Something's Gotta Give
./music/Frank Sinatra/20 Classic Tracks/15 Too Close for Comfort
./music/Frank Sinatra/20 Classic Tracks/16 I Could Have Danced All Night
./music/Frank Sinatra/20 Classic Tracks/14 Dancing in the Dark
./music/Frank Sinatra/20 Classic Tracks/08 Brazil
./music/Frank Sinatra/20 Classic Tracks/02 Around the World
./music/Frank Sinatra/20 Classic Tracks/06 Let's Get Away from It All
./music/Frank Sinatra/20 Classic Tracks/10 It's Nice to Go Trav'ling
./music/Frank Sinatra/20 Classic Tracks/20 Day In - Day Out
./music/Frank Sinatra/20 Classic Tracks/17 Saturday Night (Is the Loneliest Night of the Week)
./music/Frank Sinatra/20 Classic Tracks/07 April in Paris
I would like it to chop the whole filename off and just leave the dir that the files are in.
Thanks, trscookie.
if you are using GNU find
Code:
find . -iname "*.wma" -printf "%f\n"
Code:
find . -iname "*.wma" | while read -r f
do
echo ${f%/*}
done
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.