copy files modified after specific date using cp switches

What is happening here is that when you use the -R option to cp and supply a directory as an argument, it copies everything in that directory. Moreover, this will not preserve the directory structure as any files in lower directories will be copied directly to /tmp/2. This may be what you want (see X Tian's answer for how to do it this way), but beware if any files have the same name, one will overwrite the other at the detination.

To preserve the directory structure, you can use cpio:

find . -mtime -60 -print0 | cpio -0mdp /tmp/2

If the -0 (or equivalent) option is unavailable, you can do this, but be careful none of your file names contains a newline:

find . -mtime -2 | cpio -mdp /tmp/2

cpio should also support the -L option, although be careful with this as in some cases it can cause an infinite loop.


You should exclude directories, the first file find prints is . in addition you use the recursive option on the copy.

So following is more what you intended, however as Graeme points out, cpio -pdm will preserve the original directory structure, cp will only copy into destination directory.

find . -mtime -60 -type f -exec cp -Lv --preserve=timestamps {} /tmp/2 \;

I'm leaving this answer to highlight the difference between Graeme and this solution. Since I do think it adds something to the overall answer to original question. Other readres might find this interesting.