Search code examples
unixfindcpmv

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


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 {} +

Solution

  • 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 "https://stackoverflow.com/questions/143171/how-can-i-use-xargs-to-copy-files-that-have-spaces-and-quotes-in-their-names/149026#149026" as well.