How to move or copy files listed by 'find' command in unix?

L P picture L P · Jun 28, 2013 · Viewed 173.5k times · Source

I have a list of certain files that I see using the command below, but how can I copy those files listed into another folder, say ~/test?

find . -mtime 1 -exec du -hc {} +

Answer

Ankur picture Ankur · Oct 3, 2013

Adding to Eric Jablow's answer, here is a possible solution (it worked for me - linux mint 14 /nadia)

find /path/to/search/ -type f -name "glob-to-find-files" | xargs cp -t /target/path/

You can refer to "How can I use xargs to copy files that have spaces and quotes in their names?" as well.