Find and copy files

copy, find, linux

Solution

If your intent is to copy the found files into `/home/shantanu/tosend`, you have the order of the arguments to `cp` reversed:

find /home/shantanu/processed/ -name '*2011*.xml' -exec cp "{}" /home/shantanu/tosend  \;

Please note: the `find` command uses `{}` as placeholder for the matched file.

Problem

Why does the following does not copy the files to the destination folder? ``` # find /home/shantanu/processed/ -name '*2011*.xml' -exec cp /home/shantanu/tosend {} \; cp: omitting directory `/home/shantanu/tosend' cp: omitting directory `/home/shantanu/tosend' cp: omitting directory `/home/shantanu/tosend' ```

Original source