Here’s my trouble - i’ve been doing it manually but i’m getting backlogged - lots of baby photos you know…
I like to name my digital camera photos by the date created in the following format: yymmdd##.jpg, so 2/21/02 #4 would be: 02022104.jpg
I’ve tried Better finder rename, drop rename, filebuddy, etc, but none of them can do that format. Am I missing some software that can do this, or is there an AppleScript solution?
The reason is that after I name my files, I reduce them and post them on my web site, but I want to be able to easily find the original and know when I took it without taking the time to add a date caption, and the date modified on the image may change when I finally get around to sampling it down, so the filename is my best bet for keeping the date correct.
And i’m not on OSX so iPhoto won’t work for me… yet…
Thanx!
: Here’s my trouble - i’ve been doing it manually but i’m getting
: backlogged - lots of baby photos you know…
: I like to name my digital camera photos by the date created in
: the following format: yymmdd##.jpg, so 2/21/02 #4 would be:
: 02022104.jpg
: I’ve tried Better finder rename, drop rename, filebuddy, etc, but
: none of them can do that format. Am I missing some software
: that can do this, or is there an AppleScript solution?
: The reason is that after I name my files, I reduce them and post
: them on my web site, but I want to be able to easily find the
: original and know when I took it without taking the time to
: add a date caption, and the date modified on the image may
: change when I finally get around to sampling it down, so the
: filename is my best bet for keeping the date correct.
I think this should do what you want. I wasn’t entirely clear as to the original naming format of the files, so things might need to be adjusted a bit to match.
on run
open ({choose file})
end run
on open (itemList)
repeat with anItem in itemList
set filePath to (anItem as text)
if last character of filePath is not ":" then
set {od, AppleScript's text item delimiters} to ¬
{AppleScript's text item delimiters, {":"}}
set fileName to text item -1 of filePath
set AppleScript's text item delimiters to od
set off1 to offset of "#" in fileName
if off1 is not 0 then
set fileDate to text 1 thru (off1 - 1) of fileName
set off2 to offset of "." in fileName
if off2 is not 0 then
set theSuffix to text off2 thru -1 of fileName
set photoIndex to text (off1 + 1) thru (off2 - 1) of fileName
set fileName to buildName(fileDate, photoIndex) & theSuffix
tell application "Finder" to set name of file filePath to fileName
end if
end if
end if
end repeat
end open
on buildName(dateText, theIndx)
set {od, AppleScript's text item delimiters} to ¬
{AppleScript's text item delimiters, {"/"}}
set {MM, DD, YY} to text items of dateText
set AppleScript's text item delimiters to od
set MM to leadingZeros(MM, 2)
set DD to leadingZeros(DD, 2)
set theIndx to leadingZeros(theIndx, 2)
return YY & MM & DD & theIndx
end buildName
on leadingZeros(theText, theWidth)
if (count theText) is less than theWidth then
set theText to (text (0 - theWidth) thru -1 of ("00000000" & theText))
return theText
else
return theText
end if
end leadingZeros
Marc K. Myers
Marc@AppleScriptsToGo.com
AppleScriptsToGo
4020 W.220th St.
Fairview Park, OH 44126
(440) 331-1074
[02/21/2002 11:56:05 AM]
PS: This script is set up as a droplet. Save it as an applet and you’ll be able to drop groups of files on its icon for mass conversion of their names.
Marc K. Myers
Marc@AppleScriptsToGo.com
AppleScriptsToGo
4020 W.220th St.
Fairview Park, OH 44126
(440) 331-1074
[02/21/2002 12:05:24 PM]
Marc,
Thanks for the fantastic response - great detail and speed!
Fortunately, i’ve found a couple programs that seem to do this for me as well:
For OS X - FileRenamer: http://www.versiontracker.com/moreinfo.fcgi?id=13559&db=mac
For OS 9 - Cameraid http://www.cameraid.com/
But i’m going to keep your code handy because i’ve got a non-camera application that I might need it for. And i’ll keep your info handy if I need some other custom-designed scripts - thank you!