[ls+mplayer]recurcive directory cat question

i believe this is a wright place to post such article

i want give list of the files in music directory to mplayer’s input

in current directory i can play this way

ls *.ogg|mplayer .

ls -R

give the list of all files in sub-directories

ls -R *.ogg|mplayer .

i have nothing…

please help with advise on my question.

You are under a misunderstanding here. The ls does nothing useful. mplayer does not read input for a list of files. The reason it happens to work is because . matches any file with a dot in the middle of the name and certainly matches any file ending in .ogg. mplayer probably ignores the non .ogg files.

ls -R

give the list of all files in sub-directories

ls -R *.ogg|mplayer .

i have nothing…

please help with advise on my question.

Try this:

find . -name '*.ogg' -print0 | xargs -0 mplayer

This also handles files with spaces in them by the way. You’d have to read up on find and xargs to understand how this works.

thank you very much
this is completely new to me. i did not use nor find and xarg i will read about this thank you ken_yap one more time…