My requirement is to find the space consumed and count of incoming files every month. So say If I have a directory "X" I would like to know the space and for the month of November
Following is the command we used to get the details.
cd x
Output1=$(find . -type f -newermt 2017-11-01 ! -newermt 2017-11-30 | wc -l)
Output2=$(find . -type f -newermt 2017-11-01 ! -newermt 2017-11-30 | du -sk)
echo "Count of file is $Output1 and Space occupied by files is $Output2 KB"
We ran the above command for 3 different ranges a) 1 Oct to 31st Oct , b) 1st Oct to 30th Nov, and c) 1st Nov to 30th Nov.
My expectation was a) + b) should be = C but it is not. Can you please share your views on this. Or can you please let me know if there is anything wrong with the command I am using. Or Please share if you have a better option for my requirement.
Count of file is 3679280 and Space occupied by files is 19766351768 Count of file is 6857725 and Space occupied by files is 19765912668 Count of file is 3063226 and Space occupied by files is 19765541452