find "/var/www/site1/" -maxdepth 1 -type f | xargs ls -1S | head -n 4 | xargs -d '\n' rm -f
I'm using abovethe 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 '\n' rm -f It works fine, but from time to time throws broken pipe error.
xargs: ls: terminated by signal 13
Anyone can see way to improve this to prevent those kind of issues. Thanks for help.
xargs: ls: terminated by signal 13