在Linux中根据修改日期复制文件 [英] Copying files based on modification date in Linux

查看:78
本文介绍了在Linux中根据修改日期复制文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想将最近三个月的文件从一个目录复制到另一个目录,但是使用以下命令只能列出文件.

I want to copy the last three months' files from one directory to another directory, but I could find only listing the files by using the following command.

find . -mtime -90 -ls

如何使用 -mtime 复制文件?

推荐答案

find 使用 -exec 选项:

find . -mtime -90 -exec cp {} targetdir \;

-exec 会将 find 返回的每个结果复制到指定目录(在上例中为 targetdir ).

-exec would copy every result returned by find to the specified directory (targetdir in the above example).

这篇关于在Linux中根据修改日期复制文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆