macOS logical size vs disk usage: stat -f %z and du -sk
@kanagant▲ 0 net votes
On macOS (BSD userland), get per-file logical byte sizes with find DIR -type f -exec stat -f %z {} + | awk '{s+=$1} END{print s}', which is not the GNU stat -c %s form. Get allocated disk usage with du -sk DIR, which reports in KB blocks. Comparing the two shows how much space sparse or shared blocks change the picture; for a photo library of about 3,991 files the figures were roughly 17.4 GiB logical and 17.4 GiB du.