Welcome to the most active Linux Forum on the web.
Go Back > Forums > Linux Forums > Linux - Software
User Name
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.


Closed Thread
  Search this Thread
Old 09-02-2009, 05:02 AM   #1
LQ Newbie
Registered: Sep 2009
Location: In another land where the breeze and the trees and flowers glow blue
Distribution: Ubuntu 9.04, distrohopper
Posts: 11

Rep: Reputation: 0
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.
Old 09-02-2009, 05:28 AM   #2
LQ Guru
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,509

Rep: Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983
Already replied here: Please don't do double posts, otherwise it's difficult to follow the discussion. Thanks.

Closed Thread

bash, photos, scripting

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Using Bash, Find script files in a directory or subdirectories within... ray5_83 Programming 4 10-10-2008 07:42 PM
copy and rename the existing directory using BASH script neo2k Linux - Software 3 08-20-2008 10:43 AM
To rename files in a directory should I use Bash script or a Perl Script ? jamtech Programming 7 01-22-2008 11:25 PM
Bash Expression: Current Directory & All Subdirectories Below gmcauley Programming 2 01-01-2007 02:36 PM
Bash script to traverse directory tree and rename files intramaweb Programming 3 10-08-2006 12:51 PM > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 03:32 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration