2 ################################################################################
5 # Description: Reports large files
6 # Parameters: See usage
7 # Author: Andrew@DeFaria.com
8 # Created: Mon May 24 09:09:24 PDT 1999
9 # Modified: <date> by Andrew@DeFaria.com
10 # Language: Korn Shell
12 # (c) Copyright 2001, Andrew@DeFaria.com, all rights reserved
14 ################################################################################
18 print "usage: $me: [ -verbose | -v ] [ -size | -s n ] [ <filesystem> ]"
19 print "\t\t[ -top n | -t n ] [ -notop | -not ]\n"
21 print " -size | -s n\tShow only files bigger then n Meg (default 1 Meg)"
22 print " -verbose | -v\tTurn on verbose mode (default verbose off)"
23 print " -top | -t n\tPrint out only the top n largest files (default LINES - 1)"
24 print " -notop|not\tPrint out all files (default top LINES - 1)"
25 print " <filesystems>\tFilesystems to check (default all hfs filesystems)"
39 integer size=$size_in_meg*$bytes_in_meg/$block_size
41 while [ $# -gt 0 ]; do
46 # Convert size to 512 blocks
47 size=$size_in_meg*$bytes_in_meg/$block_size
72 print -u2 "$me: Error: Unknown option $1"
78 filesystems="$filesystems $1"
84 if [ "_$filesystems" = "_" ]; then
86 df -k -F ufs | while read line; do
88 filesystems="$filesystems $(echo $line | awk '{print $6}')"
95 if [ $verbose = "on" ]; then
96 print "Filesystems:\t$filesystems"
97 print "Size:\t\t$size_in_meg Meg ($size blocks)"
98 print "Top:\t\t$top_n"
101 if [ $top_n -eq 0 ]; then
104 head_cmd="head -$top_n"
107 find $filesystems -xdev -size +$size -exec ls -l {} \; |\
108 sort +nr5 | awk '{ printf ("%.3f %s\t%s\n", $5/(1024*1024), $3, $9) }' |