Sometimes the system will report there is no disk space available although actual disk space IS available when running df -h. This is happening when the total number of inodes is reached Can be checked with df -i
The below script will list folders which are containing the highest number of files
#!/bin/bash
if [ $# -ne 1 ];then
echo "Usage: `basename $0` DIRECTORY"
exit 1
fi
echo "Sjedi drmni pivo, sad ce lista..."
find "$@" -type d -print0 2>/dev/null | while IFS= read -r -d '' file; do
echo -e `ls -A "$file" 2>/dev/null | wc -l` "files in:\t $file"
done | sort -nr | head -n 30 | awk '{print NR".", "\t", $0}'
exit 0