How to deal with a folder containing very large number of files

If you’ve ever gone into a directory, for example, a mail or log directory, and wanted to clear it of its contents, but faced an error like this:
/bin/rm: cannot execute [Argument list too long]

If you have too many files to remove, try this trick:

find . -name ‘*’ | xargs rm -v

Leave a Comment

Your email address will not be published. Required fields are marked *