Delete folder in a directory which are two months old

I need help. I have to create a script which will delete multiple directory (folders) that are two months old. Example, I have folders dated April, May, June and July. I have to delete folders April and May and retain June and July and as such that when the July month lapse, the folder June will be deleted.

Thanks for the help.

There are lots of threads related to same topic.
Please use search. You can also have a look at the thread listing at the bottom of this page with the similar topic.

below code will give directories older than two months, means not JUN and not JUL.

prev_mth=`date --date="last month" +%b`
curr_mth=`date "+%b"`
ls -lth | grep "^d" | awk -v CM=$curr_mth -v PM=$prev_mth  ' $6 != CM  { if ( $6 != PM ) print $9 }'