Forum Discussion
Altera_Forum
Honored Contributor
14 years agoToo many filename matches
Hello, I got a system that records to a Compact Flash disk. Everything works great except when I try to delete a bunch of files using rm *.dat. It gives me the message: "Too many filename ...
Altera_Forum
Honored Contributor
14 years agoThe usual way to avoid the argument limit is using 'xargs', typically:
find . -name '*.dat' | xargs rmalthough in your case: echo *.dat | xargs rmmay well work, but I'm not sure busybox has xargs. You could so something like (untested): rm_all()
{
while
do
rm "$1" "$2" "$3" "$4" "$5" "$6" "$7" "$8" "$9"
shift 9
done
rm "$@"
}
rm_all *.dat
Since it is likely that the shell function argument limit is larger than that for exec.