Search code examples
macosbashmp3cp

Move only mp3s within multiple directories to a single folder


This solution from SO works but unfortunately some of my mp3s have quotes (') in their names which results in the following error:

xargs: unterminated quote

Is it possible to adapt the following command to allow it to copy all mp3s, regardless of the quotes in their file name?

find . -name "*.mp3" | xargs -I {} cp -iv "{}" /my/dir

Thank you.


Solution

  • find . -name "*.mp3" -exec cp -iv {} /my/dir \;