查找在日期范围之间创建的文件 [英] Find files in created between a date range

查看:123
本文介绍了查找在日期范围之间创建的文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在这里通过telnet使用AIX,我想知道如何在日期范围之间的特定文件夹中查找文件.例如:我想查找文件夹X中在13年8月1日至13年8月31日之间创建的所有文件.

I use AIX via telnet here at work, and I'd like to know how to find files in a specific folder between a date range. For example: I want to find all files in folder X that were created between 01-Aug-13 and 31-Aug-13.

观察:

  • 一旦我在服务器上拥有的用户角色不允许我创建文件,touch技巧(在其中创建两个空文件以使用-newer选项的方法)对我不起作用.
  • 我需要在特定日期而不是几天之间查找(例如:30天内创建的文件,等等...)
  • The touch trick (where you create two empty files to use the -newer option) does not work for me, once the user roles that I have on the server does not allow me to create files.
  • I need to find between specific dates, not days (like: files that were created more than 30 days ago, etc...)

推荐答案

您可以使用以下内容找到所需的内容.

You can use the below to find what you need.

查找早于特定日期/时间的文件:

Find files older than a specific date/time:

find ~/ -mtime $(echo $(date +%s) - $(date +%s -d"Dec 31, 2009 23:59:59") | bc -l | awk '{print $1 / 86400}' | bc -l)

或者您可以在两个日期之间找到文件.第一个日期较新,最后一个日期较旧.您可以选择第二个,而不必使用mtime.您可以使用所需的任何东西.

Or you can find files between two dates. First date more recent, last date, older. You can go down to the second, and you don't have to use mtime. You can use whatever you need.

find . -mtime $(date +%s -d"Aug 10, 2013 23:59:59") -mtime $(date +%s -d"Aug 1, 2013 23:59:59")

这篇关于查找在日期范围之间创建的文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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