LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   Handling wildcards... (https://www.linuxquestions.org/questions/linux-general-1/handling-wildcards-305621/)

artificialGekko 03-24-2005 03:27 PM

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?

Dark_Helmet 03-24-2005 06:53 PM

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.

artificialGekko 03-24-2005 08:00 PM

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? :confused:

Dark_Helmet 03-24-2005 08:15 PM

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" )

artificialGekko 03-24-2005 08:23 PM

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 :)

Dark_Helmet 03-24-2005 08:29 PM

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.


All times are GMT -5. The time now is 04:52 PM.