复制基于Linux中修改日期的文件 [英] Copying the files based on modification date in linux

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

问题描述

这可能是一个重复的问题,但我无法找到此我想一个最近3个月的文件从一个目录复制到另一个目录的解决方案,但我只能找到列出使用以下命令的文件。

It may be a duplicate question but i could not find the solution for this i want to copy a last 3 months files from one directory to another directory but i could find only to listing the files by using the following command.

find . -mtime -90 -ls

我真的不知道如何将文件通过使用 -mtime 复制。我是新来的Linux请帮助我。

I really don't know how to copy the files by using -mtime. I'm new to linux please help me.

推荐答案

使用了 -exec 选项找到

Use the -exec option for find:

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

-exec 将由返回的每个结果发现到指定目录(复制TARGETDIR在上面的例子)。

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

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