Make xargs handle filenames that contain spaces

$ ls *mp3 | xargs mplayer  

Playing Lemon.  
File not found: 'Lemon'  
Playing Tree.mp3.  
File not found: 'Tree.mp3'  

Exiting... (End of file)  

My command fails because the file “Lemon Tree.mp3” contains spaces and so xargs thinks it’s two files. Can I make find + xargs work with filenames like this?

13 Answers
13

Leave a Comment