#!/bin/sh #目标文件夹下面所有问题 target_dir="/app/" #删除2天前新建的后缀为log的文件 -name "*.log" -exec rm -rf {} \; #查找出文件夹下所有的log文件 list=`find $target_dir -name "*.log"` for file in $list do if test -f $file then #清理 cat /dev/null > $file ls -
du -ah --max-depth=1 这个是我想要的结果 a表示显示目录下所有的文件和文件夹(不含子目录),h表示以人类能看懂的方式,max-depth表示目录的深度. du命令用来查看目录或文件所占用磁盘空间的大小.常用选项组合为:du -sh 一.du的功能:`du` reports the amount of disk space used by the specified files and for each subdirectory (of directory argum