LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
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.

Notices


Closed Thread
  Search this Thread
Old 09-02-2009, 05:40 AM   #1
shy_guest
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:46 AM   #2
colucix
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
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.
 
Old 09-02-2009, 05:53 AM   #3
centosboy
Senior Member
 
Registered: May 2009
Location: london
Distribution: centos5
Posts: 1,137

Rep: Reputation: 116Reputation: 116
Quote:
Originally Posted by shy_guest View Post
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

Last edited by centosboy; 09-02-2009 at 06:02 AM. Reason: amended
 
  


Closed Thread

Tags
bash, photos, scripting



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
Bash script to rename photos in directory & all subdirectories shy_guest Linux - Software 7 09-02-2009 01:40 PM
Bash script to rename photos in directory & all subdirectories shy_guest Linux - Software 1 09-02-2009 05:28 AM
Using Bash, Find script files in a directory or subdirectories within... ray5_83 Programming 4 10-10-2008 07:42 PM
Bash Expression: Current Directory & All Subdirectories Below gmcauley Programming 2 01-01-2007 02:36 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

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

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