summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLars Wirzenius <liw@liw.fi>2014-03-09 10:46:46 +0000
committerLars Wirzenius <liw@liw.fi>2014-03-09 10:46:46 +0000
commit4a458404fa00bf42bc1b92e11831a6c19e70142d (patch)
treec1343b2b3cd977e412ae0d08e1d63ebe4383af5c
parent16001877d5d9d2454a5317c345dba7f5272bfdd1 (diff)
downloadextrautils-4a458404fa00bf42bc1b92e11831a6c19e70142d.tar.gz
Add filecount
-rw-r--r--Makefile2
-rwxr-xr-xfilecount9
-rw-r--r--filecount.127
3 files changed, 37 insertions, 1 deletions
diff --git a/Makefile b/Makefile
index 1b1819f..c005307 100644
--- a/Makefile
+++ b/Makefile
@@ -8,7 +8,7 @@ progs = corrupt isascii
scripts = assert do-until minimify splitmboxdaily \
setuppy-debian-versions-match viewprof fix-shebang \
musictomp3 test-flacs unpack-debian-sources \
- humanify benchmark-cmd print-argv
+ humanify benchmark-cmd print-argv filecount
manpagesin = $(shell ls *.1.in)
CFLAGS = -Wall -O2 --std=gnu99
diff --git a/filecount b/filecount
new file mode 100755
index 0000000..e58f95d
--- /dev/null
+++ b/filecount
@@ -0,0 +1,9 @@
+#!/bin/sh
+
+set -eu
+
+for dir in "$@"
+do
+ n=$(find "$dir" -printf x | wc -c)
+ printf '%8d %s\n' "$n" "$dir"
+done
diff --git a/filecount.1 b/filecount.1
new file mode 100644
index 0000000..150040a
--- /dev/null
+++ b/filecount.1
@@ -0,0 +1,27 @@
+.\" Copyright 2014 Lars Wirzenius <liw@liw.fi>
+.\"
+.\" This program is free software: you can redistribute it and/or modify
+.\" it under the terms of the GNU General Public License as published by
+.\" the Free Software Foundation, either version 3 of the License, or
+.\" (at your option) any later version.
+.\"
+.\" This program is distributed in the hope that it will be useful,
+.\" but WITHOUT ANY WARRANTY; without even the implied warranty of
+.\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+.\" GNU General Public License for more details.
+.\"
+.\" You should have received a copy of the GNU General Public License
+.\" along with this program. If not, see <http://www.gnu.org/licenses/>.
+.\"
+.TH FILECOUNT 1
+.SH NAME
+filecount \- count number of files in directories
+.SH SYNOPSIS
+.B filecount
+.RI [ DIR ...]
+.SH DESCRIPTION
+.B filecount
+counts the number of files, subdirectories, etc, in each directory
+named on the command line.
+.SH OPTIONS
+No options.