Revision: 22669
Updated Code
at January 11, 2011 10:57 by tm
Updated Code
# 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"
Revision: 22668
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at January 18, 2010 23:24 by tm
Initial Code
# 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 # 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"
Initial URL
Initial Description
Initial Title
Count results of find
Initial Tags
Bash, find
Initial Language
Bash