Revision $Id: ftimes-map-size-ditties.base,v 1.2 2006/04/08 19:49:03 klm Exp $ Purpose This recipe is a collection of little ditties related to the size attribute. Motivation If a ditty is worth remembering, it's worth writing down and sharing. Requirements UNIX or Windows platform with FTimes and Perl installed. Time to Implement These ditties are designed to be cut-n-paste ready. There should be little, if any, time involved. Solution This ditty finds all files and directories on the system (including mounted shares) that have a size greater than 100,000,000 bytes: UNIX: ftimes --mapauto none+size -l 6 | perl -ne '($name,$size)=split(/[|]/); next unless ($size > 100000000); print;' Windows: ftimes --mapauto none+size -l 6 | perl -ne "($name,$size)=split(/[|]/); next unless ($size > 100000000); print;" This ditty determines the number of bytes consumed by all files and directories on the system (including mounted shares): UNIX: ftimes --mapauto none+size -l 6 | perl -ne '($name,$size)=split(/[|]/); $total+=$size; END { print $total,"\n"; }' Windows: ftimes --mapauto none+size -l 6 | perl -ne "($name,$size)=split(/[|]/); $total+=$size; END { print $total; }" Note: if you want to restrict the size calculation to a smaller set of files and/or directories run the command like so: UNIX: (restricted to /tmp and /var/tmp) ftimes --mapauto none+size -l 6 /tmp /var/tmp | perl -ne '($name,$size)=split(/[|]/); $total+=$size; END { print $total,"\n"; }' Windows: (restricted to C:\Temp and D:\Temp) ftimes --mapauto none+size -l 6 C:\Temp D:\Temp | perl -ne "($name,$size)=split(/[|]/); $total+=$size; END { print $total; }" Closing Remarks Watch out for quoting issues when crossing between UNIX and Windows platforms. If you have a ditty you'd like to share, let me know and I'll add it to the list. Credits This recipe was brought to you by Klayton Monroe. References FTimes is available here: http://ftimes.sourceforge.net/FTimes/