linux - how to play .mp3 songs randomly by searching for them recursively in a directory and its sub directories? -
Once I'm in the directory with .mp3 files, I run random songs using - Z * .mp3 But if I want to find a directory and its subfolders for .mp3 files and run them randomly, then I tried the following command, but it does not work is. Mpg123 -Z & lt; (Find / media -name * .mp3) (find / media -name * .mp3), when executing all .mp3 files currently / media and its sub directory. / P>
mpg123 -Z $ (find-name "*. Mp3")
< / Pre>$ (...) means execute the command and paste the output.
Also, to specify the command line length limit, try:
mpg123 -Z $ (find -name "* .mp3" | sort - Random-sort | head -n 100)Edit: Sorry, try:
find -name "* .mp3" | Sort --random-sort | Head-n 100 Xargs -d '\ n' mpg123
This should be properly addressed from the blank, assuming that you do not have file names with embedded newlines.
This will index your list of MP3 randomly, then select the first 100 of the random list, then pass them to mpg123.
Comments
Post a Comment