Copy/rename using datetime and %c

Started by jsetsaas, July 27, 2010, 07:14:01 AM

Previous topic - Next topic

jsetsaas

Hi Phil,

And thanks for a great tool ! :-)

I want to use Exiftool to copy/move and rename files based on the CreateDate (actually replacing the core of a tool I've written myself, but want to get rid of all the EXIF stuff, which is so much better in EXIFTOOL).

The statement looks something like this:
-v0 -o dummy\ "-FileName<CreateDate" -d "c:\usrn\diatest\dest\%Y\%Y.%m\%Y.%m.%d@%H.%M.%S-%%c-JES.%%e" c:\usrn\diatest\src

However, if I've taken several images within the same second (burst), the first image the %c will be empty, and there will be two dashes, while the second image will have %c=1, and -1-JES in the file name. The main disadvantage with this, is that the first image will be sorted last in the sequence. What I really would like:

If there are no more images in the same second:
   2010.07.27@13.10.10-JES.jpg
If there are more images in the same second:
   2010.07.27@13.10.11-1-JES.jpg
   2010.07.27@13.10.11-2-JES.jpg

Is there a simple way to do this?
If not, could I add this as a feature request :-)

Best regards
John


Phil Harvey

#1
Hi John,

ExifTool processes one image at a time, and what you are asking doesn't really fit into this model.  You can force the copy number to be added to all filenames by adding a "." to the "%c".  And adding a "n" will start counting from 1.  So with "%.nc", you can get this:

If there are no more images in the same second:
   2010.07.27@13.10.10-1-JES.jpg
If there are more images in the same second:
   2010.07.27@13.10.11-1-JES.jpg
   2010.07.27@13.10.11-2-JES.jpg

Which is close to what you want.

Alternatively you could avoid printing "-1" for all first images by removing the leading dash from your format string and using "%-.nc", but as you mention the resulting sort order may not be what you want.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

jsetsaas

Hi,

and thanks for your reply. Yes, I do understand the problem.
With my software, I actually keep a list of all the files in memory while being processed, so I could compare in-memory.

But forcing a number always to be added, is the second-best solution. Wasn't aware that this was possible. Thanks for the update.  :-)
(I guess I could then quite easily create a second pass which would remove the -1 from all images where there is no -2 etc.)

John