Agedu – Finding Old Files
I almost never delete anything (not on purpose anyway). Having said that, sometimes I do need to find old data on a server and offload it to a NAS. Agedu has been around for ages. It’s a great tool for visually identifying directories on the server containing data that may be ripe for archiving.
Install agedu
and a couple of other utilities that may come in handy.
yum -y install agedu telnet coreutils
As a test, run
agedo
for the /opt
filesystem:agedu --no-cross-fs --progress --scan /opt
Now launch the Web UI to view the report. The syntax below will determine your machine’s primary IP, pick an available port, run the UI without authorization requirements (so only use on the internal network), and automatically kill the Web UI after a minute.
timeout 60 agedu --web --address $(dig +short $(hostname) | head -1):\ $(for port in $(seq 8080 65000); do echo -ne "5" | telnet $(dig +short $(hostname) | head -1) \ ${port} > /dev/null 2>&1; [ $? -eq 1 ] && echo ${port} && break; done) --auth none
The Web UI example is below.
Additional options from agedu --help
usage: agedu [options] action [action...] actions: -s, --scan directory scan and index a directory -w, --web serve HTML reports from a temporary web server -t, --text subdir print a plain text report on a subdirectory -R, --remove remove the index file -D, --dump dump the index file on stdout -L, --load load and index a dump file -S, --scan-dump directory scan only, generating a dump -H, --html subdir print an HTML report on a subdirectory --cgi do the right thing when run from a CGI script options: -f, --file filename [most modes] specify index file --cross-fs [--scan] cross filesystem boundaries --no-cross-fs [--scan] stick to one filesystem --prune wildcard [--scan] prune files matching pattern --prune-path wildcard [--scan] prune pathnames matching pattern --exclude wildcard [--scan] exclude files matching pattern --exclude-path wildcard [--scan] exclude pathnames matching pattern --include wildcard [--scan] include files matching pattern --include-path wildcard [--scan] include pathnames matching pattern --progress [--scan] report progress on stderr --no-progress [--scan] do not report progress --tty-progress [--scan] report progress if stderr is a tty --dir-atime [--scan,--load] keep real atimes on directories --no-dir-atime [--scan,--load] fake atimes on directories --no-eof [--web] do not close web server on EOF --mtime [--scan] use mtime instead of atime --files [--web,--html,--text] list individual files -r, --age-range age[-age] [--web,--html] set limits of colour coding -o, --output filename [--html] specify output file or directory name --address addr[:port] [--web] specify HTTP server address --auth type [--web] specify HTTP authentication method --auth-file filename [--web] read HTTP Basic user/pass from file --auth-fd fd [--web] read HTTP Basic user/pass from fd -d, --depth levels [--text,--html] recurse to this many levels -a, --age age [--text] include only files older than this also: -h, --help display this help text -V, --version report version number --licence display (MIT) licence text