A glob matches too many files
Commonrm *.log, cp * dest/ or tar czf a.tgz * in a directory with a very large number of files.
Confirm
find . -maxdepth 1 -name '*.log' | wc -l
Tens or hundreds of thousands of matches
Fix
- Let find do the work in batches: find . -maxdepth 1 -name '*.log' -type f -delete, or find … -exec cmd {} + for other commands.
- Or pipe names to xargs: find . -name '*.log' -print0 | xargs -0 rm.
- For copies and archives, pass the directory itself (cp -r dir dest, tar czf a.tgz dir) instead of dir/*.