LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (http://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   error with find . | xargs (http://www.linuxquestions.org/questions/linux-newbie-8/error-with-find-%7C-xargs-264473/)

cbonar 12-09-2004 10:53 AM

error with find . | xargs
 
arrrghh !!!

I want to play all movies in all SUBdirectories of the current one.

So I tried :
Code:

find . | xargs mplayer
but it says (in french, although it's almost not understandable) :
Code:

xargs: Le paramètre simple n'est pas repérable par apostrophe.
which would approximately be (in english) :
Code:

xargs: The (bare?|simple?|unique?) parameter is not (locatable?) with quotes.

What did I make wrong ?

I also tried :
Code:

find . -mindepth 1 | xargs mplayer
so I don't have the "." entry, but I got the same error message...


-----------------

Here's a sample of the output of the former find . command (top and bottom) :
Code:

.
./dos
./dos/complet
./dos/complet/sweden-back-front.mpg
./dos/complet/jennie-50m-side2.mpg
./dos/complet/jennie-start.mpg
./dos/complet/laurentino.mpg
./dos/complet/oliveirapedro.mpg
./dos/complet/jennie-25m-side.mpg
./dos/complet/sweden-turn2-side.mpg
./dos/complet/jennie-front.mpg
./dos/complet/JensPetterson2.mpg
./dos/complet/JensPetterson3.mpg
./dos/complet/JensPetterson4.mpg
./dos/complet/JensPetterson5.mpg
./dos/backswim-men-stroke-side.mpg
./dos/Peirsol-stroke.mpg
./dos/Phelps-backstroke-under.mpg
./dos/lenny1.mpeg
./dos/lenny2.mpeg
./dos/MbackPiersolRecovery.mpeg
./dos/lenny3.mpeg
./dos/Peirsol-finishing.mpg
./dos/backstroke_07.jpg
./dos/Backswim-kayaking.mpg
./dos/Nina-golden-touch.mpg
./dos/Backstroke-SwimcityMediaCentre-NakamuraSilver&MocanuGoldOR100mSydney2000.mpg
./dos/welsh-bodyroll.mpg
./dos/depart
./dos/depart/backstart-men-good position.mpg
./dos/depart/Welsh-front.mpg

...

./brasse/Russian-women-breast-wide-knees-inward-sweep.mpg
./brasse/Poleska-style.mpg
./divers
./divers/Video-TestingTrolley.mpg
./divers/Story_400x320.mpg


visaris 12-09-2004 10:58 AM

Maybe you want to try somthing like this? :

Code:

prompt> find . -name "*word_you_are_looking_for_here*" -print
or maybe even:

Code:

prompt> find . | grep word_you_are_looking_for_here
Hope that helps!

visaris 12-09-2004 11:02 AM

Gosh, I'm sorry. I didn't even read all of your post.

I use mplayer to play all my movies like so:

Code:

prompt> mplayer *.mpeg *.avi *.mpg
It should be that simple. I do use extra options, so my actual line is more like:

Code:

prompt> mplayer -fs -loop 0 *.mpeg *.avi *.mpg
(great for pr0n...)

visaris 12-09-2004 11:09 AM

Gee, I don't know what's wrong with me today. I misread your post _twice_.

Try this:

Code:

find . -print | grep .mpeg | xargs mplayer
The only reason, I can think of that this doesn't work is that your filenames or directories might contain spaces or quote characters...

cbonar 12-09-2004 11:18 AM

Thanks for you 3 posts !!! LOL

but
Code:

find . -print | grep .mpg | xargs mplayer
behaves exactly the same... :(

The weird thing is that I've used this pattern (find . | xargs) for a long time, and it used to work...
I must miss some important thing, but I don't see which one...

visaris 12-09-2004 11:22 AM

Maybe you can play around with xargs to try and feel it out? Maybe put the paths of a few movies in a file, and they do somthing like:

Code:

cat file_with_movie_paths_here | xargs
I think xargs defaults to echo, so this should give you the contents of the original file back.. Maybe if you play with it like this you can gain more insight into what is wrong?

cbonar 12-09-2004 12:08 PM

Well, the problem seems to come from the maximum amount of chars (20K according to the man page) xargs can handle (what the error message doesn't lead to understand).

I'm still dubious about that, because :
  • find . | wc -m gives me 13379 characters, which is still under 20000 AFAIK
  • find . | xargs -s 50000 mplayer, which should allow xargs to handle up to 50K characters, gives me the exact same error

:(

I think I'll have to fall back with a find . -exec mplayer "{}" \; which I don't like because I never remember the exact syntax, and furthermore it spans multiple successive mplayer instances, so I cannot stop the whole playlist by typing 'q' at mplayer...

:scratch:

cbonar 12-09-2004 12:22 PM

Ok, I've found another way to do it, less convenient, but easy to remember.
However, it should only work with mplayer since it uses its ability to read play lists.

Code:

find . > found
mplayer -playlist found



All times are GMT -5. The time now is 01:04 AM.