Hi all,
I have more than 12000 files in 46 different directories and each directory has 2 sub-directories named �dat� or �gridded�. Dat sub-directories have files with extension �jpg.dat� and gridded sub-directories have files with extension �.jpg�.
I need to rename all the files (some parts to be replaced or removed and most of the parts to be rearranged) in all the directories and sundirectories.
Example name of the files:
Old names:
(an example file from gridded subdirectories)
gridded_yihF-b3861-DNA433-c1-384-20110301-Tp32-CmKan-Sel2-384-MMS-32C-set1-plate1.jpg
(an example file from dat subdirectories)
yihF-b3861-DNA433-c1-384-20110301-Tp32-CmKan-Sel2-384-MMS-32C-set1-plate1.jpg.dat
New names:
tom_dm-MMS_yihF-b3861_1_[1-4]_DNA433-20110301.jpg
tom_dm-MMS_yihF-b3861_1_[1-4]_DNA433-20110301.jpg.dat
In the new name, words come in this order with these changes:
(1) �gridded� needs to be replaced with �tom� (in all the files from all the gridded subdirectories).
(2) �MMS� needs to come just after �tom� and it can also be �RM� instead of �MMS�
(3) �yihF-b3861� word will be different in every file
(4) �plate1� will be replaced with �1�. It can be �plate2� which needs to be replaced by �2�
(5) �set1� needs to be replaced with �[1-4]�. It can be set2, set3 or set4 and needs to be changed [2-4], [3-4] or [4-4] respectively.
(6) � DNA433-c1-384-20110301� part will different in each file. It needs to be renamed to � DNA433-20110301� but the �c1-384� which needs to be removed, is same in every file.
(7) File extensions �.jpg� or �.jpg.dat� remains the same.
Remaining part of the old name (i. e. -Tp32-CmKan-Sel2-384-) will be left out or deleted.
Thanks in advance. I appreciate your time.