LinuxQuestions.org
Go Job Hunting at the LQ Job Marketplace
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices

Reply
 
Search this Thread
Old 04-19-2005, 06:12 AM   #1
linuxfond
Member
 
Registered: Jan 2003
Location: Belgium
Distribution: Mandrake 9.2
Posts: 475

Rep: Reputation: 30
renaming digital camera files


Hi folks,

I know you folks do this sort of jobs from within a shell, because otherwise you would not do it at all.

If you have, say 300 pictures in a folder, and they are named like P101001.JPG, P101002.JPG etc how can I rename them all with one blow?

It would be wonderful to add, say, 01-04-2005- in front of P101001.JPG so that it looks like 01-04-2005-P101001.JPG
01-04-2005-P101002.JPG
01-04-2005-P101003.JPG
etc.

Thanks for the tips.

l

P.S. THis is to minimize the risk of having two files with the same name and without the date.
 
Old 04-19-2005, 06:38 AM   #2
slackie1000
Senior Member
 
Registered: Dec 2003
Location: Brasil
Distribution: Arch
Posts: 1,037

Rep: Reputation: 45
hi there,

something in these lines
Code:
#!/bin/sh
dummy=`date | awk '{print $2 "_" $3 "_" $6 "_"}'`
for i in `ls *jpg`
do
mv $i ${dummy}${i}
done 
exit
should work..

regards
slackie1000
 
Old 04-20-2005, 05:04 AM   #3
linuxfond
Member
 
Registered: Jan 2003
Location: Belgium
Distribution: Mandrake 9.2
Posts: 475

Original Poster
Rep: Reputation: 30
Thanks! Well, it does not work, but I see the logic. Will try to get it work.
 
Old 04-20-2005, 05:14 AM   #4
basileus
Member
 
Registered: Nov 2004
Location: Turku, Finland
Distribution: Debian, Ubuntu, Gentoo
Posts: 388

Rep: Reputation: 30
Try installing "gqview". Versions 1.x might do the job, but at least 2.x versions do...

Select several files and do a "File/Rename", choose "Automatic renaming" or similar, and that it... it's pretty easy to use.

I've found gqview to be excellent for basic editing of digital photographs. You can easily rotate the images to right positions and rename them easily.
 
Old 04-20-2005, 05:50 AM   #5
cathectic
Member
 
Registered: Sep 2004
Location: UK, Europe
Distribution: Slackware64
Posts: 761

Rep: Reputation: 34
No need for horrible bash scripts, just use 'rename' (this assumes that the 'P101' part is constant in all 300):
Code:
rename P101 01-04-2005-P101 *.jpg
 
Old 04-20-2005, 06:07 AM   #6
slackie1000
Senior Member
 
Registered: Dec 2003
Location: Brasil
Distribution: Arch
Posts: 1,037

Rep: Reputation: 45
hi there,

Quote:
Originally posted by cathectic
No need for horrible bash scripts
this comment is not necessary.

regards

slackie1000
 
Old 04-20-2005, 06:54 AM   #7
linuxfond
Member
 
Registered: Jan 2003
Location: Belgium
Distribution: Mandrake 9.2
Posts: 475

Original Poster
Rep: Reputation: 30
Thanks everybody
 
  


Reply


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
Digital Camera Tank400 Mandriva 2 12-19-2004 02:51 PM
digital camera to cd poof! Linux - Software 3 11-07-2004 08:00 PM
Possible to get video files from USB Creative PC-CAM 300 digital camera/webcam? furfurdemon666 Linux - Hardware 1 08-24-2004 09:33 AM
what digital camera do i get? skeletal29 Linux - Hardware 6 10-09-2002 09:12 AM
digital camera athenerx Linux - Software 1 03-08-2002 08:04 AM


All times are GMT -5. The time now is 06:59 AM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration