Count folder with number of files:
ls . | wc -l
A typical way to handle the “argument list too long” error is via the find command. Delete all files with sess*
find . -maxdepth 1 -mindepth 1 -type f -name "sess*" -delete
tip: handle large sessions folder for php:
rm -rf sessions; mkdir sessions; chmod 1733 sessions;