AIX清除大于100 MB的文件的内容(AIX Clear contents of files larger than 100 MB)

系统教程 行业动态 更新时间:2024-06-14 17:01:31
AIX清除大于100 MB的文件的内容(AIX Clear contents of files larger than 100 MB)

我正在寻找一个命令来清除已超过100 MB的目录中的所有文件。 我正在使用AIX盒,它正在生成快速填充空间的日志。 我不想删除这些文件。 只想清除内容。

I am looking for a command for clearing all files in a directory that has become more than 100 MB. I am using an AIX box and it is generating logs that are filling the space quickly. I do not wish to delete the files. Just want to clear the contents.

最满意答案

当prog没有保持文件句柄打开时,你可以使用

find yourLogDir -type f -size +100M -exec cp /dev/null {} \;

编辑,看评论: 如果系统不支持M标志,请输入一个长号。

When the progs don't keep a file handle open, you can use

find yourLogDir -type f -size +100M -exec cp /dev/null {} \;

Edit, see comments: When the M flag is not supported on your system, enter a long number.

更多推荐

本文发布于:2023-04-20 16:13:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/dzcp/4e77be3cd996031bf1fb093d30faf4d8.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:文件   内容   MB   AIX   contents

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!