From 4a458404fa00bf42bc1b92e11831a6c19e70142d Mon Sep 17 00:00:00 2001 From: Lars Wirzenius Date: Sun, 9 Mar 2014 10:46:46 +0000 Subject: Add filecount --- Makefile | 2 +- filecount | 9 +++++++++ filecount.1 | 27 +++++++++++++++++++++++++++ 3 files changed, 37 insertions(+), 1 deletion(-) create mode 100755 filecount create mode 100644 filecount.1 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 +.\" +.\" 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 . +.\" +.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. -- cgit v1.2.1