LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 03-24-2005, 03:27 PM   #1
artificialGekko
Member
 
Registered: Mar 2005
Posts: 77

Rep: Reputation: 15
Handling wildcards...


Okay, I hope this is an at least halfway appropriate forum for my question:

I have my music in a folder home/gekko/tunes, most of them are spread across subfolders like /tunes/albumname but some are directly in the /tunes folder.
Now when I play music from the commandline using

Code:
madplay --verbose --shuffle --repeat /home/gekko/tunes/*/*
I was hoping that the first of the two wildcards also included all the single mp3s directly in the tunes folder to my "playlist" - but for some reason it ignores them and only plays all the songs in all the subfolders back.

Is there any way I can change the path-expression to have all the files play back?
 
Old 03-24-2005, 06:53 PM   #2
Dark_Helmet
Senior Member
 
Registered: Jan 2003
Posts: 2,786

Rep: Reputation: 374Reputation: 374Reputation: 374Reputation: 374
Two options come to mind (assuming all of your music files are named <something>.mp3):

Code:
madplay --verbose --shuffle --repeat /home/gekko/tunes/{*,*/*}.mp3
That should be equivalent to:
Code:
madplay --verbose --shuffle --repeat /home/gekko/tunes/*.mp3 /home/gekko/tunes/*/*.mp3
Another option would be with the find command:
Code:
madplay --verbose --shuffle --repeat $( find . -name "*.mp3" )
One thing to note: if your mp3's have spaces in their filenames, it might cause problems.
 
Old 03-24-2005, 08:00 PM   #3
artificialGekko
Member
 
Registered: Mar 2005
Posts: 77

Original Poster
Rep: Reputation: 15
The second version you posted there (with both paths) works, but the first one somehow won't. Gave me a bash syntax-error first, I tinkered around a bit until replacing the () with [] got rid of the syntax error, but still it won't do.

Code:
madplay -vzr /home/gekko/tunes/[*,*/*].mp3
comes up with "No such file or directory.

Is there perhaps still something wrong with the syntax?
 
Old 03-24-2005, 08:15 PM   #4
Dark_Helmet
Senior Member
 
Registered: Jan 2003
Posts: 2,786

Rep: Reputation: 374Reputation: 374Reputation: 374Reputation: 374
For the first command... they're not parentheses: ()
they're curly braces: { }



Give it a try with the braces.

Also, the third one should be this:
Code:
madplay --verbose --shuffle --repeat $( find /home/gekko/tunes -name "*.mp3" )

Last edited by Dark_Helmet; 03-24-2005 at 08:16 PM.
 
Old 03-24-2005, 08:23 PM   #5
artificialGekko
Member
 
Registered: Mar 2005
Posts: 77

Original Poster
Rep: Reputation: 15
Awesome! That solves all my problems... ah well at least one of them...

Now I'll go and read into that $ find -name whatever thing... looks useful
 
Old 03-24-2005, 08:29 PM   #6
Dark_Helmet
Senior Member
 
Registered: Jan 2003
Posts: 2,786

Rep: Reputation: 374Reputation: 374Reputation: 374Reputation: 374
The find command is extremely useful. I would highly recommend taking the time to learn what it is capable of. The "-exec" option is extremely nice.

Also, as a quick FYI, the "$( )" sequence I used is a special syntax for the shell. It effectively means, intepret the text between "$(" and ")" as a command, then replace everything with the output of that command... another very handy thing to know.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Use of wildcards and -R switch in ls and grep robgee1964 Linux - Newbie 7 12-04-2005 05:20 PM
copy problem using wildcards plisken Linux - General 11 11-16-2005 08:34 AM
CLI wildcards ShakyJake Linux - Newbie 4 02-28-2005 03:42 PM
Wildcards dazdaz Linux - Newbie 3 01-23-2005 05:33 AM
Wildcards in kernel Squall Linux - General 1 04-20-2004 05:22 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 07:08 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration