First I have to search the files using FIND command that will show only the files for December 2012 Secondly I need to see the total size of files searchedI used this commandfind /storage/backup/rman/ -mtime +90 -mtime -120 -exec ls -lrth {} \;But it also gave me the files of November which I don't want-rw-r--r-- 1 oraprod dba 8.7K Dec  1 22:40 /storage/backup/rman/full_011212.log-rw-r----- 1 oraprod dba 3.3G Dec 11 22:34 /storage/backup/rman/BKPPROD_aknskgvb.F_bkp-rw-r----- 1 oraprod dba 34M Dec  1 22:40 /storage/backup/rman/ctrl_011223-rw-r----- 1 oraprod dba 1.3M Dec  1 22:33 /storage/backup/rman/BKPPROD_8lnrq765.F_bkp-rw-r--r-- 1 oraprod dba 8.0K Dec 20 22:45 /storage/backup/rman/full_201212.log-rw-r----- 1 oraprod dba 34M Dec  2 22:42 /storage/backup/rman/ctrl_021223-rw-r----- 1 oraprod dba 2.5G Dec 11 22:38 /storage/backup/rman/BKPPROD_ajnskgvb.F_bkp-rw-r----- 1 oraprod dba 34M Dec 13 22:46 /storage/backup/rman/ctrl_131223-rw-r--r-- 1 oraprod dba 8.0K Dec 17 22:44 /storage/backup/rman/full_171212.log-rw-r--r-- 1 oraprod dba 8.0K Dec 10 22:38 /storage/backup/rman/full_101212.log-rw-r--r-- 1 oraprod dba 8.0K Dec 13 22:46 /storage/backup/rman/full_131212.log-rw-r--r-- 1 oraprod dba 1.4K Nov 30 22:00 /storage/backup/rman/full_301112.log-rw-r----- 1 oraprod dba 34M Dec  8 22:46 /storage/backup/rman/ctrl_081223-rw-r--r-- 1 oraprod dba 9.2K Dec 12 22:43 /storage/backup/rman/full_121212.logwhen I pass the du -ch at the end of command this is the result:8.0K    ./.gnome/gnome-vfs12K     ./.gnome24K     ./lsat-0.9.7.1/changelog920K    ./lsat-0.9.7.18.0K    ./.gconf/desktop/gnome/accessibility/keyboard12K     ./.gconf/desktop/gnome/accessibility8.0K    ./.gconf/desktop/gnome/peripherals/keyboard/host-mdfr-prod/012K     ./.gconf/desktop/gnome/peripherals/keyboard/host-mdfr-prod16K     ./.gconf/desktop/gnome/peripherals/keyboard20K     ./.gconf/desktop/gnome/peripherals36K     ./.gconf/desktop/gnome40K     ./.gconf/desktop8.0K    ./.gconf/apps/panel/applets/clock/prefs12K     ./.gconf/apps/panel/applets/clock8.0K    ./.gconf/apps/panel/applets/workspace_switcher/prefs12K     ./.gconf/apps/panel/applets/workspace_switcher8.0K    ./.gconf/apps/panel/applets/window_list/prefs12K     ./.gconf/apps/panel/applets/window_list40K     ./.gconf/apps/panel/applets44K     ./.gconf/apps/panel8.0K    ./.gconf/apps/puplet56K     ./.gconf/apps100K    ./.gconf8.0K    ./.nautilus/metafiles12K     ./.nautilus4.0K    ./.eggcups196K    ./.gstreamer-0.104.0K    ./.redhat/esc8.0K    ./.redhat8.0K    ./.gnome2/share/cursor-fonts8.0K    ./.gnome2/share/fonts20K     ./.gnome2/share4.0K    ./.gnome2/keyrings4.0K    ./.gnome2/accels4.0K    ./.gnome2/nautilus-scripts36K     ./.gnome212K     ./.metacity/sessions16K     ./.metacity4.0K    ./.Trash4.0K    ./.gnome2_private68K     ./.gconfd4.0K    ./.mozilla/extensions4.0K    ./.mozilla/plugins12K     ./.mozilla4.0K    ./Desktop2.5M    .2.5M    total
How to Calculate the Total size of file searched using Find command
rhel;find
Some versions of find (non-embedded Linux, Cygwin, OSX, FreeBSD) allow you to compare a file's modification time with a reference date with the -newermt operator.find /storage/backup/rman -newermt '2012-12-01' ! -newermt '2013-01-01'You can't use -mtime to tell whether a file was modified at a particular date, because this operator is relative to the time you run the find command. If your find doesn't have the -newermt operator, create reference files and use the -newer operator.touch -t 201212010000 starttouch -t 201301010000 endfind /storage/backup/rman -newer start ! -newer endTo get the total size of the files, use du -c and keep only the last (total) line. You'll need to exclude directories, because when you pass a directory to du, it adds up the sizes of all the files under that directory.find /storage/backup/rman -type f -newermt '2012-12-01' ! -newermt '2013-01-01' -exec du -c {} + | tail -n 1If you have a large number of files, the length of the command line might be too large, so find will run du multiple times and the command above would only list the output from the last batch. In that case you'll need to add up the amounts from each run. Here's one way to do this.find /storage/backup/rman -type f -newermt '2012-12-01' ! -newermt '2013-01-01' \     -exec sh -c 'du $@ | tail -n 1' _ {} + |awk '{total += $1} END {print total}'Exercise: what's wrong with the following command? (I.e. in what unusual but possible situation will it report a wrong figure?)find /storage/backup/rman -type f -newermt '2012-12-01' ! -newermt '2013-01-01' \     -exec du {} + |awk '$2 == total {total += $1} END {print total}'