rm argument list too long code example

Example 1: rm argument list toot long

# To delete files when we receive the message "argument list is too long"
# This is the non recursive version

find . -maxdepth 1 -name "*.pdf" -print0 | xargs -0 rm

Example 2: bash: /bin/rm: Argument list too long

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

Example 3: argument list too long

# 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