1

早上好,

我在目录中有很多文件,我现在使用的子目录复制里面的所有内容。

find /tmp/temp/ -name *files.csv -type f -exec cp -u {}  /home/dir/Desktop/dir1/ \; 

我想知道,如果有什么我可以复制的,复制文件的修改日期是否在两天内。如果修改日期比当前日期早 2 天,我不想复制。

4

1 回答 1

1

您可以mtime在 find 命令中使用:

find /tmp/temp/ -type f -mtime -2 -name *files.csv -exec cp -u {}  /home/dir/Desktop/dir1/ \;

这将仅复制在系统时间的最后两天内修改时间的文件。

-mtime n
    File's data was last modified n*24 hours ago
于 2015-08-07T01:07:57.193 回答