Thread

Posted on Wed Apr 2 23:10:06 2008 by darryl
Problems renaming a file.

This seems simple enough. In trying to test the batch captioning thing, I've got a folder full of images: IMG_5834.JPG -> IMG_5843.JPG

I want to rename them all:

sunrise on I-80 5834.JPG -> sunrise on I-80 5834.JPG

In a Windows XP command-line, I've tried:

> exiftool "-filename<sunrise on I-80 %-4f.%e" IMG_5835.JPG

And I get:

0 image files updated 1 image files unchanged

To make sure I've got the formatting correct, I tried:

> exiftool -w "sunrise on I-80 %-4f.%e" IMG_5835.JPG
And ended up with the console output for IMG_5835 dumped into a file named "sunrise on I-80 5835.jpg", as expected.
Direct Responses: 7577 | Write a response
Posted on Thu Apr 3 04:18:30 2008 by exiftool in response to 7574
Re: Problems renaming a file.
Hi Darryl,

Close. Just use an "=" sign instead of "<" and it should work.

The "<" syntax is used to copy the value of one tag to another by name, and since a tag called "sunrise on I-80 %-4f.%e" does not exist in the file, nothing happens.

And the -w option specifies the output for text output of exiftool. If you had used the -o option instead, the file would have been rewritten to an output JPG file with the specified name, but this isn't quite what you wanted either because it is much slower than simply renaming the file as when you set the filename tag.

I hope this makes sense. And btw, thanks for helping Marty and the other smugmug people with your useful posts over there.

- Phil
Direct Responses: 7855 | Write a response
Posted on Mon May 12 07:08:25 2008 by pauljsolomon in response to 7577
Re: Problems renaming a file.
I'm having similar problems with some mass file renames. I'm trying the following command and it doesn't rename my files:

exiftool -r '-FileName<CreateDate' -d PJS%Y%m%d%/PJS%Y%m%d%%-.4nc.%%e file.jpg


The only thing I can think of is that these are scanned images and they have no "Create Date" in the metadata. Thoughts? If this is the case, how do I force this with the actual file creation date? -paul.
Direct Responses: 7857 | Write a response
Posted on Mon May 12 14:07:04 2008 by exiftool in response to 7855
Re: Problems renaming a file.
Hi Paul,

What system are you running on? You should be using double quotes, not single quotes if you are on a Windows system.

You can't access the file creation date from exiftool, but you can access the modify date:

exiftool -r "-filename<filemodifydate" "-filename<createdate" -d PJS%Y%m%d%/PJS%Y%m%d%%-.4nc.%%e D +IR

This will take CreateDate if it exists, otherwise it will use the FileModifyDate.

- Phil
Direct Responses: 7868 | Write a response
Posted on Wed May 14 06:12:37 2008 by pauljsolomon in response to 7857
Re: Problems renaming a file.
Thanks so much for the response, it works like a charm! fyi, i'm running this on a mac-os (leopard) macbook. -paul.
Write a response