First Scenario - Only Size
Add the following script to .bashrc
then use it like that diff_sizes script.sh
# Use the file names, not the relative path to them, as we grep like that ./PRE_DU
PRE_DU=sizes_before.du
POST_DU=sizes_after.du
diff_sizes() { du -ab | grep -Pv "^0\t" | grep -Pv "[0-9]+\t./(${PRE_DU})|(${POST_DU})" >${PRE_DU}; $1; du -ab | grep -Pv "^0\t" | grep -Pv "[0-9]+\t./(${PRE_DU})|(${POST_DU})+" >${POST_DU}; diff ${PRE_DU} ${POST_DU}; };
Second Scenario - Both Size and Date
Add the following script to .bashrc
then use it like that diff_sizes_and_dates script.sh
alias file_sizes_and_dates="find . -type f -exec ls -al {} + | awk {'printf(\"%8s\t%s %2s %5s %s\n\",\$5,\$6,\$7,\$8,\$9)'}"
PRE_DU=sizes_before.du
POST_DU=sizes_after.du
diff_sizes_and_dates() { file_sizes_and_dates | grep -Pv "^\s*0\t" | grep -Pv " ./(${PRE_DU})|(${POST_DU})$" >${PRE_DU}; $1; file_sizes_and_dates | grep -Pv "^\s*0\t" | grep -Pv " ./(${PRE_DU})|(${POST_DU})$" >${POST_DU}; diff ${PRE_DU} ${POST_DU}; };
Further command breakdown is here