LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (http://www.linuxquestions.org/questions/linux-software-2/)
-   -   Bash script to rename photos in directory & all subdirectories (http://www.linuxquestions.org/questions/linux-software-2/bash-script-to-rename-photos-in-directory-and-all-subdirectories-752048/)

shy_guest 09-02-2009 05:40 AM

Bash script to rename photos in directory & all subdirectories
 
I have several thousand photofiles both scanned & from various digital cameras. I have organised them more or less chronologically into directories by year and subdirectories by month. They are all in JPEG format but file extensions vary from .jpg to .JPG & perhaps even .JPEG

The scanning software has given me over hundreds of files with the same name, since after the standard prefix, it numbers them uniquely only within the current directory. Various cameras have given their files different prefixes before a file number.

I would like to rename them all uniquely by giving each one a prefix followed by a padded 7 figure chronological serial number starting at 0000100 (in fact numbering them by hundreds so that if I find any further photos, I can insert them in the gaps without too much hassle) followed by the extension .jpg. I want the script to be easily modifiable so that all subsequent batches can be given the same treatment.

I want to keep the files in their current directories & subdirectories.

I have looked but don't see any software that seems to do this & it occurred to me that a bash script should be able to do it, but I don't know enough to write the script.

Can a bash script expert please help me.

colucix 09-02-2009 05:46 AM

Please, stop to post the same thread. I have already answered to one of your previous identical posts: you can follow discussion there: http://www.linuxquestions.org/questi...tories-752037/. This one reported for closure.

centosboy 09-02-2009 05:53 AM

Quote:

Originally Posted by shy_guest (Post 3666622)
I have several thousand photofiles both scanned & from various digital cameras. I have organised them more or less chronologically into directories by year and subdirectories by month. They are all in JPEG format but file extensions vary from .jpg to .JPG & perhaps even .JPEG

The scanning software has given me over hundreds of files with the same name, since after the standard prefix, it numbers them uniquely only within the current directory. Various cameras have given their files different prefixes before a file number.

I would like to rename them all uniquely by giving each one a prefix followed by a padded 7 figure chronological serial number starting at 0000100 (in fact numbering them by hundreds so that if I find any further photos, I can insert them in the gaps without too much hassle) followed by the extension .jpg. I want the script to be easily modifiable so that all subsequent batches can be given the same treatment.

I want to keep the files in their current directories & subdirectories.

I have looked but don't see any software that seems to do this & it occurred to me that a bash script should be able to do it, but I don't know enough to write the script.

Can a bash script expert please help me.


amended


All times are GMT -5. The time now is 10:55 PM.