My OS is Solaris 10 (64 bit) and I have many files in a logs directory where we receive 40-50 logs every day. I have last 20 days file present in this directory and I want to move each day file to a particular directory whose name is appended with the date of file.
File_name date 1.txt 31-jul-20122 2.txt 01-Aug-2012
then create a directory for old files belongs to 31-jul-2012 and move to new directory 31-jul RIO_31-Jul-2012 and move them and like wise for 01-aug files.
I have written a scripts which is running fine for current date but i don't know how t modify it to accomdate old date.
My scripts is as below
NEWDIR=RIO_31-Jul-2012 mkdir /ersdg3/ERS/ERS_INPUT_LOGS/RIO/LOGS/$NEWDIR cd /var/opt/ers/logs/rio touch -t `date +%Y%m%d0000` dummy find . -newer dummy -type f | while read fname do mv $fname /ersdg3/ERS/ERS_INPUT_LOGS/RIO/LOGS/$NEWDIR done