<h3 id="crontab">Crontab</h3>
<p><code>0 3 * * 0 /bin/du -m /data/ &gt; /home/USER/du_files/&quot;du_$(/bin/date +\%Y\%m\%d)&quot;</code></p>
<h3 id="script">Script</h3>
<pre><code>cd ~/du_files
TODAYS_FILE=&quot;du_$(/usr/bin/date +%Y%m%d)&quot;
YESTERDAYS_FILE=&quot;du_$(/usr/bin/date --date=&quot;7 days ago&quot; +%Y%m%d)&quot;
/usr/bin/echo &quot;create table old (oldsize integer, path varchar);&quot; &gt; delta.sql
/usr/bin/echo &quot;create table new (newsize integer, path varchar);&quot; &gt;&gt; delta.sql
/usr/bin/echo &#39;.separator &quot;\t&quot; &#39; &gt;&gt; delta.sql
/usr/bin/echo &quot;.import $TODAYS_FILE new&quot; &gt;&gt; delta.sql
/usr/bin/echo &quot;.import $YESTERDAYS_FILE old&quot; &gt;&gt; delta.sql
/usr/bin/echo &quot;.mode csv&quot; &gt;&gt; delta.sql
/usr/bin/echo &quot;.headers on&quot; &gt;&gt; delta.sql
/usr/bin/echo &quot;.out deltas.csv&quot; &gt;&gt; delta.sql
/usr/bin/echo &quot;select *,newsize-oldsize as delta_in_megabytes from old natural join new where oldsize&lt;newsize order by delta_in_megabytes desc;&quot; &gt;&gt; delta.sql

/usr/bin/sqlite3 &lt; delta.sql

echo $YESTERDAYS_FILE|/usr/bin/mailx -a deltas.csv -s deltas.csv me@mywork.com</code></pre>
<h3 id="resulting-sql">Resulting SQL</h3>
<pre><code>create table old (oldsize integer, path varchar);
create table new (newsize integer, path varchar);
.separator &quot;\t&quot;
.import du_20160821 new
.import du_20160814 old
.mode csv
.headers on
.out deltas.csv
select *,newsize-oldsize as delta_in_megabytes
from old    natural join new    where oldsize&lt;newsize
order by delta_in_megabytes desc;</code></pre>
