On 25.12.2011 23:09, Allan McRae wrote:
On 26/12/11 03:27, Dave Reisner wrote:
On Sun, Dec 25, 2011 at 06:20:27PM +0100, Florian Pritz wrote:
On 25.12.2011 16:06, Dave Reisner wrote:
Why can't we use @SIZECMD@ here? Same issues as du?
SIZECMD returns one file size per line so we'd also have to add them up.
Yup. I do this in paccache:
@SIZECMD@ "${candidates[@]}" | awk '{ sum += $1 } END { print sum }'
I'm happy using @SIZECMD@:
find . -print0 | xargs -0 stat -L -c %s | awk '{sum += $1 } END {
allan@mugen ~/tmp/libreoffice print sum }' 196464312
allan@mugen ~/tmp/libreoffice
find . -print0 | xargs -0 cat 2>/dev/null | wc -c 195276472
allan@mugen ~/tmp/libreoffice
du -sb 196444140 .
Of course the numbers between the stat and wc approach are different because stat adds a "block size" amount for each directory of which there is 290 in the libreoffice package:
(196464312 - 195276472) / 4096 = 290
So the SIZECMD approach is filesystem dependent, but in a way that is creates minimal difference, unlike the current approach which can wildly vary. It is also about the same speed as the current du based approach.
find . \! -type -d -print0 -- Florian Pritz