Need script to move files based on month

Hi ,

I need a script which moves files based on month. Example :

Apr 29 03:16 log4.txt
Apr 29 03:16 log5.txt

May  4 09:17 log1.txt
May  4 09:17 log2.txt

Move Apr files into Apr2015(Folder)
Move May files into May2015(Folder).

This is urgent requirement , if you can help me that would be great.

Thanks

Any attempts from your side?

I'm using below script , but it will move files based on today date:

#!/bin/bash

MONTH="$(date +'%d''%b''%Y')"

FILES="$(date +'%d''%m''%Y')"

mkdir "${MONTH}"

mv ${FILES}_*.xls ${MONTH}

But I need it to be moved to Folder with a Month(Apr2015).

Try - presumed the folder exist - :

for i in *.txt; do echo mv "$i" ./${i:0:3}2015/; done

Remove the echo if happy...

The year should be generic (It should be incremental). Can you please put in a script and give it to me.

No. I leave this up to you as an exercise.