rm: Argument list too long

Written by Peter Davies on .

Magento is odd... the session directory stores a lot of session files so much so I got a:

rm sess*
/bin/rm: Argument list too long.

So, that implies there's too many files to delete! The simplest alternative is to then use the following which deletes each file in-turn:

find . -name 'sess*' -print0 | xargs -0 rm