免费注册 查看新帖 |

Chinaunix

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

HP UX目录下根据创建时间删除文件的问题 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2009-09-08 15:02 |只看该作者 |倒序浏览
HP UX目录下根据创建时间删除文件的问题
1. root用户
2. 在某个目录下有50多个文件
3. 创建日期(通过#ll命令看到的日期是创建日期吧?)各不相同。分别为9月1号,9月2号,以此类推。
-----------------------------------------------------------------------
怎么删除9月1号创建的所有文件??

论坛徽章:
0
2 [报告]
发表于 2009-09-08 15:02 |只看该作者
HP UX目录下根据创建时间删除文件的问题
1. root用户
2. 在某个目录下有50多个文件
3. 创建日期(通过#ll命令看到的日期是创建日期吧?)各不相同。分别为9月1号,9月2号,以此类推。
-----------------------------------------------------------------------
怎么删除9月1号创建的所有文件??


---------------------------------------------------------------------------------------------------------------

#find . -ctime n –exec rm {} \\;
n =(today- target day approximate)

#find . -atime +8 –exec rm {} \\;

atime for access time
+ means more than (n+1)*24hours

论坛徽章:
0
3 [报告]
发表于 2009-09-08 15:09 |只看该作者
以今日8号算
#find . -atime +8 –exec rm {} \\;

论坛徽章:
0
4 [报告]
发表于 2009-09-09 10:23 |只看该作者

回复 #2 smart_zhaozf 的帖子

能帮忙解释一下该命令吗?
----------------------------
find 不是查找命令吗?
----------------------------
以今日8号算
#find . -atime +8 –exec rm {} \\;
----------------------------
原来:
查找满足 -atime +8的文件并执行rm的命令.
----------------------------------------------------------------------
-atime n                    True if the file access time subtracted from
                             the initialized time is n-1 to n multiples of
                             24 h. The initialization time shall be a time
                             between the invocation of the find utility and
                             the first access by that invocation of the find
                             utility to any file specified by its path
                             operands.  The access time of directories in
                             pathname_list is changed by find itself.
                             
                             
                             
-ctime n                    True if the time of last change of file status
                             information subtracted from the initialization
                             time is n-1 to n multiples of 24 h. The
                             initialization time shall be a time between the
                             invocation of the find utility and the first
                             access by that invocation of the find utility
                             to any file specified by its path operands.

[ 本帖最后由 TOADLover 于 2009-9-14 12:57 编辑 ]

论坛徽章:
0
5 [报告]
发表于 2009-09-09 10:25 |只看该作者
哪位路过的朋友能帮忙解释下这条命令
#find . -atime +8 –exec rm {} \\;

论坛徽章:
0
6 [报告]
发表于 2009-09-09 11:24 |只看该作者
查找满足 -atime +8的文件并执行rm的命令.

man find 可以看到相关的说明.

论坛徽章:
0
7 [报告]
发表于 2009-09-09 13:30 |只看该作者
楼主给分吧,不过不要生搬2楼的,看好提示,以今日8号……

论坛徽章:
0
8 [报告]
发表于 2009-09-09 16:46 |只看该作者
-atime n                    True if the file access time subtracted from
                             the initialized time is n-1 to n multiples of
                             24 h. The initialization time shall be a time
                             between the invocation of the find utility and
                             the first access by that invocation of the find
                             utility to any file specified by its path
                             operands.  The access time of directories in
                             pathname_list is changed by find itself.
                             
                             
                             
-ctime n                    True if the time of last change of file status
                             information subtracted from the initialization
                             time is n-1 to n multiples of 24 h. The
                             initialization time shall be a time between the
                             invocation of the find utility and the first
                             access by that invocation of the find utility
                             to any file specified by its path operands.

论坛徽章:
0
9 [报告]
发表于 2009-09-15 16:12 |只看该作者
晕了,还是不行:
-----------------------------
[root@ora10g testfile]# find . -atime +15 exec rm {} \\
>
find: paths must precede expression
Usage: find [path...] [expression]
[root@ora10g testfile]#

论坛徽章:
0
10 [报告]
发表于 2009-09-15 16:13 |只看该作者
哪位路过,给点提示?????????
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

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

清除 Cookies - ChinaUnix - Archiver - WAP - TOP