find-large: A PHP script for finding large files

No Comments

I just pushed a small script, which I call 'find-large', to github. It's usage is loosely based on the 'find' command.

find-large is a small PHP script that lists the largest files in a directory. While there are many methods to do this with linux tools, my partner and I wanted something a little easier to use.

Usage: /home/jlogsdon/bin/find-large [path] [options]
Find the largest files in a path.

-n Number of files to list (default: 25)
-r Resets the default file AND directory patterns. WARNING: order matters
with this option. Any previous patterns you have added will be removed
as well.
-f File pattern to ignore, chainable (default: none)
-d Directory pattern to ignore, chainable (default: .svn, .git)
-s Minimum file size in bytes. For ease of use, you may add a suffix.
Allowed suffixes are: k, m, g. (default: 10m)
-q Quiet mode. Only outputs the list of files.
-m Print file sizes in bytes, less readable output.

File and directory patterns may contain one or more wildcards ('*'). It is suggested
you put each pattern inside of single quotes to prevent your shell from expanding the
pattern.

Example Usage

$ find-large /usr
Scanning files........
Completed scan in 25.83 seconds

Found 8 that met your criteria

53.84m /usr/lib/locale/locale-archive
19.38m /usr/lib/xulrunner-1.9/libxul.so
17.92m /usr/lib/httpd/modules/libphp5.so
16.98m /usr/local/bin/php
14.68m /usr/share/gnome-applets/gweather/Locations.xml
13.39m /usr/share/icons/Bluecurve/icon-theme.cache
12.76m /usr/share/selinux/targeted/base.pp
11.98m /usr/share/selinux/targeted/enableaudit.pp