simple script to count number of files in a directory
authorChris Koeritz <fred@gruntose.com>
Wed, 21 Jul 2021 20:20:05 +0000 (16:20 -0400)
committerChris Koeritz <fred@gruntose.com>
Wed, 21 Jul 2021 20:20:05 +0000 (16:20 -0400)
doesn't include directories.  may not be perfect; does look for lines ending in a colon, to remove directory headings from recursive ls list.

scripts/files/fast_counter.sh [new file with mode: 0644]

diff --git a/scripts/files/fast_counter.sh b/scripts/files/fast_counter.sh
new file mode 100644 (file)
index 0000000..c40e33a
--- /dev/null
@@ -0,0 +1,7 @@
+
+
+for dir in "${@}"; do
+  /bin/ls -1fR "$dir" | grep -v "^$" | grep -v "^\.$" | grep -v "^\.\.$" | grep -v "$dir\/.*:$" | wc
+done
+
+