« rsync 单模块认证配置 /etc/rsyncd.conf | Main | ICP 终于批下来了 »
July 13, 2005
find 和 exec xargs
版权声明:可以任意转载,转载时请务必以超链接形式标明文章原始出处和作者信息及本声明。 https://windtear.net/archives/2005/07/13/000716.html http://windtear.net/archives/2005/07/13/000716.html find ./ -type d -mtime +5 -maxdepth 1 -exec rm -rf {} \; find ./ -type f -ctime +30 | xargs rm -f 由于 exec 能接受的长度有些系统会有限制 所以 xargs 就有了其伟大价值 xargs 接到参数就开始处理 而不是像 exec 那样土鳖 非要接受到全部 所以呢 大家尽量 xargs 吧 NAME find - search for files in a directory hierarchy SYNOPSIS find [path...] [expression] ACTIONS -exec command ; Execute command; true if 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 current file name being processed everywhere 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 quoted to protect them from expansion by the shell. The command is exe- cuted in the starting directory. NAME xargs - build and execute command lines from standard input |
Posted by windtear at July 13, 2005 12:00 AM