Operating System - Linux
1753962 Members
7473 Online
108811 Solutions
New Discussion юеВ

Re: script to find big files

 
larsoncu
Advisor

script to find big files

I'm looking for a script that I know existed years ago.

what it did was find the big files that were on the system. saves the output. compares that output to a master list (known big files and their size) and mails the differences.

this way it filters out acceptable large files like the kernel, libraries, etc. and only mails the big files that are growing in size.

I was wondering if someone has a copy that they would be willing to share.

thanks
2 REPLIES 2
Sandman!
Honored Contributor

Re: script to find big files

What do you mean by "big files"? Please say how big a "big file" should be in order to appear in the output of the desired script.

~thanks
A. Clay Stephenson
Acclaimed Contributor

Re: script to find big files

I would say that learning to write such a script is far more important than hunting one up to do such a straightforward task. I would almost certainly do this in Perl using the File::Find module but this should get you started as a shell example:

#!/usr/bin/sh

TDIR=${TMPDIR:-/var/tmp}
typeset F1=${TDIR}/F${$}_1.list
typeset BIG=1000000 # find any files larger that this

trap 'eval rm -f ${F1}' 0 1 2 3 15

find / -local -type f -size +${BIG}c -exec ls -l {} \+ | sort > ${F1}

File ${F1} now contain a list of "big" files that you can compare to your master list.

Presumably you master list is also sorted.



If it ain't broke, I can fix that.