哪位大侠能帮我看看这几条命令什么意思,操作日志文件的好像是

[复制链接]
查看11 | 回复6 | 2011-11-1 16:24:04 | 显示全部楼层 |阅读模式
cd /u01/admin_log/out
find . -mtime +5 -name "o*.out" -exec rm {} \;
find . -mtime +10 -name "CUX*.PDF" -exec rm {} \;
find . -mtime +10 -name "CUX*.EXCEL" -exec rm {} \;

回复

使用道具 举报

千问 | 2011-11-1 16:24:04 | 显示全部楼层
find . -mtime +5 -name "o*.out" -exec rm {} \;
find . -mtime +10 -name "CUX*.PDF" -exec rm {} \;
find . -mtime +10 -name "CUX*.EXCEL" -exec rm {} \;
查找/u01/admin_log/out目录下
1,时间超过5天的,文件名以o开头,以.out结尾的删掉
2.时间超过10天的,文件名以CUX开头,以.PDF结尾的删掉
3,时间超过10天的,文件名以CUX开头,以.EXCEL结尾的删掉
回复

使用道具 举报

千问 | 2011-11-1 16:24:04 | 显示全部楼层
-mtime n

File's data was last modified n*24 hours ago.
-name pattern

Baseoffile name (the path with the leading directories removed) matches shell pattern pattern.The metacharac-

ters ('*', '?', and '[]') do not match a '.' at the start of the base name.To ignore a directoryandthefiles

under it, use -prune; see an example in the description of -path.
-exec command ;

Executecommand;trueif 0 status is returned.All following arguments to find are taken to be arguments to the

command until an argument consisting of ';' is encountered.The string '{}' is replaced by the currentfilename

beingprocessedeverywhere it occurs in the arguments to the command, not just in arguments where it is alone, as

in some versions of find.Both of these constructions might need to be escaped (with a '\') or quotedtoprotect

them from expansion by the shell.The command is executed in the starting directory.
回复

使用道具 举报

千问 | 2011-11-1 16:24:04 | 显示全部楼层
谢谢。。。
回复

使用道具 举报

千问 | 2011-11-1 16:24:04 | 显示全部楼层
感觉xargs写法要清晰点
回复

使用道具 举报

千问 | 2011-11-1 16:24:04 | 显示全部楼层
ocpdba591 发表于 2012-5-28 19:00
感觉xargs写法要清晰点

xargs是什么意思,您能不能帮我举个例子。
回复

使用道具 举报

千问 | 2011-11-1 16:24:04 | 显示全部楼层
huziaa 发表于 2012-5-29 09:49
xargs是什么意思,您能不能帮我举个例子。

参考下:
http://www.chineselinuxuniversity.net/articles/42297.shtml
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

主题

0

回帖

4882万

积分

论坛元老

Rank: 8Rank: 8

积分
48824836
热门排行