#!/bin/sh - # # This is similar to the du(1) command, # but counts inodes instead of blocks. # # Usage: di [--] [ ...] # # Note that empty directories are not displayed separately, # but of course they're counted as an inode for their parent # directory. # # Copyright (C) 2005 by Oliver Fromme, all rights reserved world-wide # Oliver Fromme, Munich / Germany, , # # BSD-style copyright, license and standard disclaimer apply. # # case "$1" in --) shift ;; -*) echo "Usage: $0 [--] []" >&2 exit 1 ;; esac if [ $# -lt 1 ]; then set . fi find "$@" | awk ' { t++ while (sub("/[^/]*$", "")) { n[$0]++ } } END { for (i in n) if (i) printf "%d\t%s~\n", n[i], i if ('$#' > 1) printf "%d\t~~~total\n", t - '$#' } ' | sort -k 2 | sed 's/~$//;s/ ~~~total$/ total/' #--