I'm using the following command to delete four largest size files in a folder:
find "/var/www/site1/" -maxdepth 1 -type f | xargs ls -1S | head -n 4 | xargs -d '
' rm -f
It works fine, but from time to time throws broken pipe error:
xargs: ls: terminated by signal 13
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…