openSUSE Forums > Archives > Novell Archives » Rename files With Creation Date?

Go Back   openSUSE Forums > Archives > Novell Archives
Forums FAQ Members List Search Today's Posts Mark Forums Read


Novell Archives Archived content from Novell openSUSE support forums

 
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 24-Apr-2007, 14:40
Tim Musa
Guest
 
Posts: n/a
Default Rename files With Creation Date?

Hello,

I'm new to using Linux as my full time PC at home (though I have been using
a MythTV box for about a year now, so I have some Linux experience). One
process I have yet to figure out how to replicate is transferring my images
and movies from my camera and renaming them. Actually it is just the
renaming portion that I need assisstance with. On my Windows PC I had
renamed all of my images as YYYY-MM-DD-HHMMSS.<ext> (jpg or mov) during the
import process. I have tried searching for a script or something that
would perform this task on Linux. I found that JHead would do this for all
of my images, using the EXIF information, but I would still need something
to rename all of my movies.

I figure that this is possible with some sort of shell script, but I don't
know how to get the file date information in the script. I'm hoping that
someone here can offer some insight.

--
-----------------------------------------------------------------
Timothy M. Musa
Community Consolidated School District 93
Carol Stream, IL

http://www.ccsd93.com/
-----------------------------------------------------------------
  #2 (permalink)  
Old 26-Apr-2007, 01:37
Birger
Guest
 
Posts: n/a
Default Re: Rename files With Creation Date?

Tim Musa wrote:
> Hello,
>
> I'm new to using Linux as my full time PC at home (though I have been using
> a MythTV box for about a year now, so I have some Linux experience). One
> process I have yet to figure out how to replicate is transferring my images
> and movies from my camera and renaming them. Actually it is just the
> renaming portion that I need assisstance with. On my Windows PC I had
> renamed all of my images as YYYY-MM-DD-HHMMSS.<ext> (jpg or mov) during the
> import process. I have tried searching for a script or something that
> would perform this task on Linux. I found that JHead would do this for all
> of my images, using the EXIF information, but I would still need something
> to rename all of my movies.
>
> I figure that this is possible with some sort of shell script, but I don't
> know how to get the file date information in the script. I'm hoping that
> someone here can offer some insight.
>


I made a hack to dump my camera into a directory, where all files is named after the date
in the EXIF field.

You can maybe use some of it for your own script.

#!/bin/bash

Olympus=/media/usbdisk

cd ${Olympus}/dcim/100olymp || exit


for i in *.jpg
do
exif=$(exiftran -d $i |grep '0x0132' |\
sed -e 's,.*Date and Time.*\(20..\)(..\)(..\) \(..\)(..\)(..\),\1\2\3-\4\5\6.jpg,')
if [ ! -e $exif ]
then
cp $i ~/Olympus/$exif
fi
done

If you will have YYYY-MM-DD-HHMMSS , change the sed to \1-\2-\3-\4\5\6.jpg

For movies I don't know, since my own movies are from dv format first, and I use
dvgrab --timestamp , so they get this name from start.
Some day I must test MythTV , but I'm not there yet.


/birre
  #3 (permalink)  
Old 26-Apr-2007, 01:41
Birger
Guest
 
Posts: n/a
Default Re: Rename files With Creation Date?

Birger wrote:
> Tim Musa wrote:
>> Hello,
>>
>> I'm new to using Linux as my full time PC at home (though I have been using
>> a MythTV box for about a year now, so I have some Linux experience). One
>> process I have yet to figure out how to replicate is transferring my images
>> and movies from my camera and renaming them. Actually it is just the
>> renaming portion that I need assisstance with. On my Windows PC I had
>> renamed all of my images as YYYY-MM-DD-HHMMSS.<ext> (jpg or mov) during the
>> import process. I have tried searching for a script or something that
>> would perform this task on Linux. I found that JHead would do this for all
>> of my images, using the EXIF information, but I would still need something
>> to rename all of my movies.
>>
>> I figure that this is possible with some sort of shell script, but I don't
>> know how to get the file date information in the script. I'm hoping that
>> someone here can offer some insight.
>>

>
> I made a hack to dump my camera into a directory, where all files is named after the date
> in the EXIF field.
>
> You can maybe use some of it for your own script.
>
> #!/bin/bash
>
> Olympus=/media/usbdisk
>
> cd ${Olympus}/dcim/100olymp || exit
>
>
> for i in *.jpg
> do
> exif=$(exiftran -d $i |grep '0x0132' |\
> sed -e 's,.*Date and Time.*\(20..\)(..\)(..\) \(..\)(..\)(..\),\1\2\3-\4\5\6.jpg,')
> if [ ! -e $exif ]
> then
> cp $i ~/Olympus/$exif
> fi
> done
>
> If you will have YYYY-MM-DD-HHMMSS , change the sed to \1-\2-\3-\4\5\6.jpg
>
> For movies I don't know, since my own movies are from dv format first, and I use
> dvgrab --timestamp , so they get this name from start.
> Some day I must test MythTV , but I'm not there yet.
>
>
> /birre


Hmm, I saw some error :-(
it should be:
if [ ! -e ~/Olympus/$exif ]

/birre
  #4 (permalink)  
Old 26-Apr-2007, 03:29
Uwe Buckesfeld
Guest
 
Posts: n/a
Default Re: Rename files With Creation Date?

Tim,

KRename can do that.

Uwe


--
Novell Support Connection Volunteer SysOp
Please don't send me support related e-mail unless I ask you to do so.
 

Bookmarks


Thread Tools
Display Modes

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




 

Search Engine Friendly URLs by vBSEO 3.3.0 RC2