From 9d92b6c43004aae77519731ba9dc8a81ca233389 Mon Sep 17 00:00:00 2001 From: PrometheusPi Date: Tue, 16 Aug 2016 09:51:08 +0200 Subject: [PATCH] add a script that counts files in all sub-directories --- bins/fileCounter | 18 ++++++++++++++++++ hypnos/fileCounter | 1 + 2 files changed, 19 insertions(+) create mode 100755 bins/fileCounter create mode 120000 hypnos/fileCounter diff --git a/bins/fileCounter b/bins/fileCounter new file mode 100755 index 0000000..f47de56 --- /dev/null +++ b/bins/fileCounter @@ -0,0 +1,18 @@ +#!/bin/bash + +if [ $# -ne 1 ] +then + DIR=. +else + DIR=$1 +fi + +echo searching in $DIR ... +echo Warning: space characters will lead to errors! + +for i in `find $DIR -maxdepth 1 -mindepth 1 -type d` +do + NFILES=`find $i -type f | wc -l` + echo $i $NFILES +done + diff --git a/hypnos/fileCounter b/hypnos/fileCounter new file mode 120000 index 0000000..c66a643 --- /dev/null +++ b/hypnos/fileCounter @@ -0,0 +1 @@ +../bins/fileCounter \ No newline at end of file