Bash: /bin/rm: argument list too long

In this article let’s discuss about Bash: /bin/rm: argument list too long. Let’s go through the following methods without any delay.

Method 1:

// aviod Argument list too long
find . -maxdepth 1 -type f -name "temp_file_name_*" -delete

If you are facing any issues with the above approach then try the alternative that is given below. It may look similar but have a try!

Method 2 :

# Non recursive

# [1] rm specific file extension
find . -maxdepth 1 -name "*.pdf" -print0 | xargs -0 rm

# [2] chmod files
find . -maxdepth 1 -name "*.html" -print0 | xargs -0 chmod 777

Hope the above solution works.

Realted Posts : Linux diff two folder recursively