File Removing on Linux rm command error ‘-bash: /usr/bin/rm: Argument list too long’


When there are thousands of files in same folder and you try to remove them all using ‘rm’ command like you always do , ERROR !

‘-bash: /usr/bin/rm: Argument list too long’ or/bin/rm: Argument list too long

How to resolve this Error:
you can use find and delete option since this way Linux will find file one by one and remove the file right after,

Sample Command to resolve this error

find <<location path>> ( -name “*” -a -type f ) -mtime +3 -print -exec rm -f {} \;

Leave a Reply

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