I really don't know if there is a standard way but I need it sometime ago and I wrote a small perl script to handle that. Here is the part of my code:
#!/usr/bin/perl
$FileName = "du-previous";
$Location = ">";
$Sizes;
# Current +++++++++++++++++++++++++++++
$Current = `du "$Location"`;
open my $CurrentFile, '<', \$Current;
while (<$CurrentFile>) {
chomp;
if (/^([0-9]+)[ \t]+(.*)$/) {
$Sizes{$2} = $1;
}
}
close($CurrentFile);
# Previous ++++++++++++++++++++++++++++
open(FILE, $FileName);
while (<FILE>) {
chomp;
if (/^([0-9]+)[ \t]+(.*)$/) {
my $Size = $Sizes{$2};
$Sizes{$2} = $Size - $1;
}
}
close(FILE);
# Show result +++++++++++++++++++++++++
SHOW: while (($key, $value) = each(%Sizes)) {
if ($value == 0) {
next SHOW;
}
printf("%-10d %s\n", $value, $key);
}
close(FILE);
#Save Current +++++++++++++++++++++++++
open my $CurrentFile, '<', \$Current;
open(FILE, ">$FileName");
while (<$CurrentFile>) {
chomp;
print FILE $_."\n";
}
close($CurrentFile);
close(FILE);
The code is not very error-tolerant so you may adjust it.
Basically the code, get the current disk usage information, compare the size with the lastest time it run (saved in 'du-previous'), print the different and save the current usage information.
If you like it, take it.
Hope this helps.