I have tens of thousands of files stored in this location in a CentOs server:
All file names are like this:
This file name represents two numbers (123 and 45678) and a full date (2013/11/29) and a time (15:45:30)
Now I have created new directories like:
I need a script to move files from the old directory to their corresponding new directories depending on year and month as mentioned above. The given file example should be moved to the directory /usr/gsm/2013/11/
The script should also rename files upon moving, replacing dashes ( - ) with underscores ( _ ), so the given file example should finally be:
Note that the first two sections (123) and (45678) can vary in length. They may be 3,4,5 or more digits. The only wan to recognise sections is by hyphens and underscores.
Would any body write the required script for me?
Thanks in advance.