update
This commit is contained in:
parent
d428dbafd1
commit
7a126b3e23
|
@ -6,14 +6,12 @@ folder="/home/pi/mp4"
|
||||||
cd $folder
|
cd $folder
|
||||||
# 获取文件夹的大小
|
# 获取文件夹的大小
|
||||||
size=$(du -sh "$folder" | awk '{print int($1)}')
|
size=$(du -sh "$folder" | awk '{print int($1)}')
|
||||||
while [[ $size -gt 50 ]]
|
while [ $size -gt 50 ]; do
|
||||||
do
|
|
||||||
# 获取最早创建的文件
|
# 获取最早创建的文件
|
||||||
oldest_file=$(ls $folder -tr | head -1 | xargs)
|
oldest_file=$(ls $folder -tr | head -1 | xargs)
|
||||||
rm -f $oldest_file
|
rm -f $oldest_file
|
||||||
size=$(du -sh "$folder" | awk '{print int($1)}')
|
size=$(du -sh "$folder" | awk '{print int($1)}')
|
||||||
if [[ $size -le 50 ]]
|
if [ $size -le 50 ]; then
|
||||||
then
|
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
done
|
done
|
Loading…
Reference in New Issue