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/*/* Is there any way I can change the path-expression to have all the files play back? |
Two options come to mind (assuming all of your music files are named <something>.mp3):
Code:
madplay --verbose --shuffle --repeat /home/gekko/tunes/{*,*/*}.mp3 Code:
madplay --verbose --shuffle --repeat /home/gekko/tunes/*.mp3 /home/gekko/tunes/*/*.mp3 Code:
madplay --verbose --shuffle --repeat $( find . -name "*.mp3" ) |
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 Is there perhaps still something wrong with the syntax? :confused: |
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" ) |
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 :) |
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. |