免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 6460 | 回复: 2
打印 上一主题 下一主题

怎么查找当前目录下前一天的文件 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2011-10-24 17:20 |只看该作者 |倒序浏览
我想查当前目录下前一天的文件
root@root:~> ls -l --time-style="+ %Y%m%d%H%M%S"
total 32
-rw-r--r-- 1 root root 126  20111022135422 a.log
-rwxr-xr-x 1 root root   50  20111023155412 b.sh
-rw-rw-r-- 1 root root 5096  20111024155412 c.sh
-rwxr-xr-x 1 root root  268  20111024155412 c.py

怎么把b.sh找出来?
我自己写了个
find . -type f  | xargs -i ls -l --time-style="+ %Y%m%d" {} | awk '{if ($(NF-1) == "20111023")print $NF}'

不知道有什么简单方法么?求指导。

论坛徽章:
0
2 [报告]
发表于 2011-10-24 17:51 |只看该作者
回复 1# gumuzhiyu

man find

       -ctime n
              File’s status was last changed n*24 hours ago.  See the comments for -atime to understand  how  rounding
              affects the interpretation of file status change times.

论坛徽章:
0
3 [报告]
发表于 2011-10-24 20:28 |只看该作者
  1. find . -ctime 2 -exec ls -l {} \;
复制代码
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP