[Klug-general] out of inodes
James Morris
james at jwm-art.net
Thu Apr 29 14:43:58 UTC 2010
Ok, I've set a threshold to display folders only containing > 1000 files
(counting recursively down). Much better output, plus file names with
spaces are not broken in this version unlike my first effort.
No commandline option for the threshold, just change value of THRESH.
----
#!/bin/bash
DIR=$1
if [ "x" == "x$1" ]
then
DIR=$PWD
fi
COUNT=0
TOTAL=0
THRESH=1000
while IFS1= read -r -d $'\0' dir; do
COUNT=0
while IFS2= read -r -d $'\0' file; do
let "COUNT += 1"
done < <(find "${dir}" -type f -print0)
if (( $COUNT > $THRESH ))
then
echo "${dir} ${COUNT} files"
fi
let "TOTAL += COUNT"
done < <(find "${DIR}" -type d -print0)
echo "total files ${TOTAL}"
----
On Thu, April 29, 2010 15:36, Dan Attwood wrote:
> yeah the outputs a lot of info. sort would defiantly be usefull. still
> it's
> good enough to fix my problem before the server get nuked at the weekend
> - because if you haven't heard it's lynx day!
> _______________________________________________
> Kent mailing list
> Kent at mailman.lug.org.uk
> https://mailman.lug.org.uk/mailman/listinfo/kent
More information about the Kent
mailing list