diff options
author | Tom Ryder <tom@sanctum.geek.nz> | 2016-09-02 14:33:21 +1200 |
---|---|---|
committer | Tom Ryder <tom@sanctum.geek.nz> | 2016-09-02 14:33:21 +1200 |
commit | 048e6446f914c188fb57693f75366e89f5974190 (patch) | |
tree | 3f3e5cdee896ed382075167f31319ff7e2bf28f1 /man | |
parent | Add mean(1df), med(1df), and mode(1df) (diff) | |
download | dotfiles-048e6446f914c188fb57693f75366e89f5974190.tar.gz dotfiles-048e6446f914c188fb57693f75366e89f5974190.zip |
Add some interesting notes to cfr(1df)
Diffstat (limited to 'man')
-rw-r--r-- | man/man1/cfr.1df | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/man/man1/cfr.1df b/man/man1/cfr.1df index ab69b347..8672d64f 100644 --- a/man/man1/cfr.1df +++ b/man/man1/cfr.1df @@ -13,7 +13,23 @@ dir1 dir2 .SH DESCRIPTION .B cf counts all the entries in the directory trees rooted at the given arguments, -and prints the total. It defaults to the current directory. +and prints the total. It defaults to the current directory. It should correctly +handle corner cases like files with newlines in them. It will count but will +not follow symbolic links. +.SH NOTES +You might think this would be better; it's certainly faster: +.P + $ find . | wc -l +.P +However, it's subtly wrong; it will double-count anything with a path that +contains a newline! +.P +cfr(1df) and cf(1df) are POSIX-fearing as far as I can tell (please correct +me), but there are faster but less compatible ways to do this, while still +remaining accurate. Here's a method using GNU find(1) adapted from an extremely +clever suggestion from geirha on Freenode; it's much, much faster: +.P + $ find . -printf %.sx | wc -c .SH SEE ALSO cf(1df), tot(1df) .SH AUTHOR |