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.
更多推荐
发布评论