ExifTool > Newbies

Strugging with Exiftool

(1/6) > >>

vetinry:
Hello all

I'm trying to rename some pictures with Exiftool from the command line and ideally using a batch file because I will want to run this several times for approx 15000 photos.

I've downloaded Exiftool.exe-k, renamed to just exiftool and moved to my windows folder.

Using Windows 7, I've opened the cmd box and the default there is c:\Users\Steve>, so not sure if this now means that my .exe is in the right place.  I have tried with exiftool in the path that the command line is pointing to.

In order to test I have, on the desktop, set up a "Test" folder where I want the picture to go, and a "Pic" folder, where I have put a few photos to practice.

I have then entered the following into Notepad on 3 lines as per below and saved as a .bat file on the desktop

exiftool-d %%Y%%m%%d-%%H%%M%%S%%%%-c.%%%%e
-filename<c:\Users\Steve\Desktop\Test\${DateTimeOriginal}
c:\Users\Steve\Desktop\Pic

I got this from a blog on life hacker where I originally got inspired to do this project.

I also tried putting the full path of exiftool in the file but then it seems to open up the help pages within exiftool without completing any renaming

When I double click on the batch file, the black CMD box appears for a split second (not long enough to read) and then disappears.  And nothing has happened to the files.

I'm sure that I am doing something obvious and stupid but can't work out what.

Please can someone help

Many thanks

Steve



ryerman:

--- Quote from: vetinry on May 31, 2014, 08:20:26 AM ---I've downloaded Exiftool.exe-k, renamed to just exiftool and moved to my windows folder.

Using Windows 7, I've opened the cmd box and the default there is c:\Users\Steve>, so not sure if this now means that my .exe is in the right place.  I have tried with exiftool in the path that the command line is pointing to.

--- End quote ---
Because exiftool.exe is in your Windows folder, you can now execute exiftool from any directory without using its full path.  It won't matter which directory is in the command prompt.


--- Quote from: vetinry on May 31, 2014, 08:20:26 AM ---I have then entered the following into Notepad on 3 lines as per below and saved as a .bat file on the desktop

exiftool-d %%Y%%m%%d-%%H%%M%%S%%%%-c.%%%%e
-filename<c:\Users\Steve\Desktop\Test\${DateTimeOriginal}
c:\Users\Steve\Desktop\Pic

--- End quote ---
For any command line:
There must be a space after exiftool
Quotes are needed for options that use "special" characters (like "<") and paths that contain spaces. I always quote all paths.

In a BAT file:
The command must be on one line.
% used in the exiftool options must be doubled. So your -dateFormat (-d) is correct for a BAT file but it should be -d %Y%m%d-%H%M%S%%-c.%%e in a command window.


--- Quote from: vetinry on May 31, 2014, 08:20:26 AM ---When I double click on the batch file, the black CMD box appears for a split second (not long enough to read) and then disappears.  And nothing has happened to the files.

--- End quote ---
The -k option will keep the command window open after execution.

Try this:
exiftool -k -d %%Y%%m%%d-%%H%%M%%S%%%%-c.%%%%e "-filename<c:\Users\Steve\Desktop\Test\${DateTimeOriginal}" "c:\Users\Steve\Desktop\Pic"

If you use this:
exiftool -k -d %%Y%%m%%d-%%H%%M%%S%%%%-c.%%%%e "-filename<c:\Users\Steve\Desktop\Test\${DateTimeOriginal}" %1
you can drag and drop any file or folder onto the BAT file and avoid editing it for every new folder.

Note that %1 is a batch file parameter and is not part of exiftool and so the % is not doubled.
You can learn more about batch file parameters here: http://pages.citebite.com/v3s3y1x0p0fhq

Jim

vetinry:
Hey Jim

Thank you very much for your reply.  I've tried both of those and they work brilliantly.  Really wish I'd been able to work it out for myself but guess this is still a bit beyond me

I'm just wondering now how much I can tweak the date and time format.  I have managed to insert underscores between the Year, Month and Day, which, for me anyway, looks easier to read.

I also tried to split the time using a colon (:), but it doesn't seem to like that.  It does however allow dots. 

exiftool -k -d %%Y_%%m_%%d-%%H.%%M.%%S%%%%-c.%%%%e "-filename<c:\Users\Steve\Desktop\Test\${DateTimeOriginal}" "c:\Users\Steve\Desktop\Pic"

Please can I ask a few more questions?
Is it possible to have a space in the filename, or do all the characters need to join?
Why is it not possible to use a colon for the time?
If I wanted to have a bracket around the multiple file numbers, where do you put the brackets?

Best wishes

Steve

vetinry:
Hi Jim
I love the option to drag the folders directly onto the batch file.  That's hopefully going to make things much easier than keep changing the file.

I've run into another hurdle though.  I've just tried dragging an assortment of pictures into the batch file.  Of about 500 files, 250 were changed, about 100 were movies (from iphone - do these have any tags?) and a further 150, which don't appear to have a date taken for them.

Can you change the {original date taken} to something else.  There does appear to be a date modified tag, although this is only from windows explorer.  I haven't yet looked at the files themselves

Cheers

Steve

Phil Harvey:
Hi Steve,

Colons are illegal in Windows file names, but you can add spaces if you have quotes around the argument.  Reading the documentation on writing the filename and directory tags may help with the date/time formatting.

I'm not sure what you mean about brackets around the file number.

You can add as many arguments as you want to write Filename from various other tags.  The last one on the command line with a tag that exists will take precedence.  Since all files have a system FileModifyDate, you can add this first to use it as a default if the other tags don't exist (DateTimeOriginal in this case).

- Phil

Navigation

[0] Message Index

[#] Next page

Go to full version