/ Published in: Bash
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
# Most any solutions use a .... | wc -l, which is wrong. It breaks (at least) if # files contain newlines. Thus the right way to do it is: find [find expression] -exec printf '.' \; | wc -c (or, more efficiently) find [find expression] -exec printf %.s. {} + | wc -c # e.g. to find all jpg-files which are larger than 1kB, you can use: find . -type f -name \*.jpg -size +1024c -exec printf '.' \; | wc -c # the "weird" -size argument is POSIX compliant. On a GNU system you could use # "-size +1k"