There is a Dutch saying: "Bij de loodgieter lekt de kraan", which literally means "The tap is leaking at the plumbers home"
My security camera records pictures and video's into my NAS server. One in a while I have to truncate the directory because it's not accessible anymore through CIFS. Within 3 months there are more than 100k files. I do this manually because I'm lazy.
Usually you will go away with just executing the rm command. But with a huge number of files you get this message:
root@nas:/mnt/Data # rm -rf dvr/*
/bin/rm: Argument list too long.
The reason you get this message is because it's a kernel limitation. You can find out the maximum number of arguments that your kernel supports with this command:
getconf ARG_MAX
The solution
Use a for loop within the current directory:
for f in *.png; do rm "$f"; done
Use find:
#To delete .png files within the current directory
find . -name ".png" -exec rm {} +
#Delete everything within the current directory
find . -name ".png" -exec rm {} +
Source: Stackoverflow