Hello!
I want to use %-c to couple with burst shot camera, but adding it to all shots that share the same second. For example, using:
$ exiftool -d '%Y-%m-%d %H.%M.%S' '-FileName<${DateTimeOriginal}%-c.${FileTypeExtension}' . I'm getting:
2010-10-16 10.54.53.jpg ---> left unchanged
2010-10-16 10.53.58.jpg ---> left unchanged
2010-10-16 10.54.03.jpg ---> left unchanged
2010-10-16 10.54.43.jpg ---> left unchanged
2010-10-16 10.54.48-1.jpg ---> ok
2010-10-16 10.54.48.jpg ---> Change to 2010-10-16 10.54.48-0.jpg
How can I change 2010-10-16 10.54.48.jpg to 2010-10-16 10.54.48-0.jpg maintaining the non burst shots as is, without adding too -0.jpg?
Thanks in advance!!
Found this answer from 2010 about the same topic in forum: https://exiftool.org/forum/index.php/topic,2746.msg12142.html#msg12142
Maybe this still can't be done with a current version of ExifTool? Please, confirm.
Anything you could do with older versions of ExifTool you can still do with newer versions (with very rare exceptions).
- Phil
Quote from: Phil Harvey on February 26, 2019, 06:59:51 AM
Anything you could do with older versions of ExifTool you can still do with newer versions (with very rare exceptions).
- Phil
Well, I was asking about the opposite, sorry ;D With the old version was not possible, maybe now is possible?
Oh, I see.
Is it only "-0" that you want to add if the "-1" file exists? If so, this will do it:
exiftool "-filename<%-.2f-0.%e" -srcfile %d%-.2f.%e DIR/*-1.jpg
- Phil
I think that the question is whether %c can be used to add -0 only when there is going to be a duplicate name. So given the examples, the results should be
2010-10-16 10.54.43.jpg
2010-10-16 10.54.48-0.jpg
2010-10-16 10.54.48-1.jpg
2010-10-16 10.54.50.jpg
on the first pass. Which I don't believe have changed since the 2010 post linked since there hasn't been any changes to the docs (see -w (textout) option (https://exiftool.org/exiftool_pod.html#w-EXT-or-FMT--textOut)). Though it's cool that you came up with a workaround.
Myself, I just switched to using an underscore instead of a dash to keep file order sorted properly.
Quote from: Phil Harvey on February 26, 2019, 07:32:28 AM
Oh, I see.
Is it only "-0" that you want to add if the "-1" file exists? If so, this will do it:
exiftool "-filename<%-.2f-0.%e" -srcfile %d%-.2f.%e DIR/*-1.jpg
- Phil
Thanks Phil for your answer. Unfortunately, I'm having a hard time getting it to work, thanks for your patience. I'm sure I'm doing something wrong:
$ ls -l
-rw-r--r-- 1 user group 1107409 27 dic 2002 2002-12-27 22.14.32-1.jpg
-rw-r--r-- 1 user group 1107409 27 dic 2002 2002-12-27 22.14.32.jpg
-rw-r--r-- 1 user group 27321426 16 oct 2010 2010-10-16 12.44.02-1.dng
-rw-r--r-- 1 user group 27321426 16 oct 2010 2010-10-16 12.44.02.dng
-rw-r--r-- 1 user group 4172842 16 oct 2010 2010-10-16 12.49.35.jpg
$ exiftool '-FileName<%-.2f-0.%e' -srcfile %d%-.2f.%e ./*-1.*
Warning: No writable tags set from ./2002-12-27 22.14.32-1.jpg
Warning: Invalid tag name '%-.2f-0.%e' - ./2002-12-27 22.14.32.jpg
Warning: No writable tags set from ./2010-10-16 12.44.02-1.dng
Warning: Invalid tag name '%-.2f-0.%e' - ./2010-10-16 12.44.02.dng
0 image files updated
2 image files unchanged
I'm expecting that
2002-12-27 22.14.32.jpg renames to
2002-12-27 22.14.32-0.jpg, that
2010-10-16 12.44.02.dng renames to
2010-10-16 12.44.02-0.dng, and that
2010-10-16 12.49.35.jpg remains unrenamed.
And... I don't know how can I integrate your answer to my currently using ExifTool order, one more
-execute maybe?:
exiftool \
-d '%Y-%m-%d %H.%M.%S' -ext 'arw' -ext 'dng' -ext 'jpg' -ext 'jpeg' -ext 'nef' -ext 'tif' -ext 'tiff' -IPTC:all= -XMP:all= -Photoshop:all= \
'-FileName<${FileModifyDate}%-c.${FileTypeExtension}' '-FileName<${MetadataDate}%-c.${FileTypeExtension}' \
'-FileName<${ModifyDate}%-c.${FileTypeExtension}' '-FileName<${CreateDate}%-c.${FileTypeExtension}' '-FileName<${DateTimeOriginal}%-c.${FileTypeExtension}' \
'-FileName<${ModifyDate}.${SubSecTime;$_=substr($_.'0',0,2)}.${FileTypeExtension}' \
'-FileName<${CreateDate}.${SubSecTimeDigitized;$_=substr($_.'0',0,2)}.${FileTypeExtension}' \
'-FileName<${DateTimeOriginal}.${SubSecTimeOriginal;$_=substr($_.'0',0,2)}.${FileTypeExtension}' \
-execute \
-d '%Y-%m-%d %H.%M.%S' -ext 'png' -IPTC:all= -XMP:all= -Photoshop:all= \
'-FileName<${FileModifyDate}%-c.${FileTypeExtension}' '-FileName<${MetadataDate}%-c.${FileTypeExtension}' '-FileName<${DateCreated}%-c.${FileTypeExtension}' \
-execute \
-d '%Y-%m-%d %H.%M.%S' -ext 'avi' \
-api largefilesupport=1 '-FileName<${DateTimeOriginal}%-c.${FileTypeExtension}' \
-execute \
-d '%Y-%m-%d %H.%M.%S' -ext 'mov' -ext 'mp4' \
-api largefilesupport=1 '-FileName<${CreateDate}%-c.${FileTypeExtension}' '-FileName<${CreationDate}%-c.${FileTypeExtension}' \
-execute \
-ext 'arw' -ext 'dng' -ext 'jpg' -ext 'jpeg' -ext 'nef' -ext 'tif' -ext 'tiff' -ext 'png' -ext 'avi' -ext 'mov' -ext 'mp4' \
-if '${FileModifyDate;tr/0-9//cd;s/^(\d{14}).*/$1/} ne ${FileName;tr/0-9//cd;s/^(\d{14}).*/$1/}' '-FileModifyDate<FileName' \
-common_args -r -overwrite_original \
.Thanks in advance!
Common Mistake #5c (https://exiftool.org/mistakes.html#M5) strikes even the best of us. ;)
Equal sign instead of Less than sign
exiftool "-filename=%-.2f-0.%e" -srcfile %d%-.2f.%e DIR/*-1.jpg
Quote from: StarGeek on February 27, 2019, 01:46:02 AM
Common Mistake #5c (https://exiftool.org/mistakes.html#M5) strikes even the best of us. ;)
Equal sign instead of Less than sign
exiftool "-filename=%-.2f-0.%e" -srcfile %d%-.2f.%e DIR/*-1.jpg
Hahahha, thank you very much StarGeek, and sorry for so strange requests ;D
What about integrating
exiftool "-filename=%-.2f-0.%e" -srcfile %d%-.2f.%e DIR/*-1.jpg in my current
exiftool order (above)? Can be done? Must exiftool be called two times?
Quote from: StarGeek on February 27, 2019, 01:46:02 AM
Common Mistake #5c (https://exiftool.org/mistakes.html#M5) strikes even the best of us. ;)
:P
Quote from: vicmarto on February 27, 2019, 01:50:39 AM
What about integrating exiftool "-filename=%-.2f-0.%e" -srcfile %d%-.2f.%e DIR/*-1.jpg in my current exiftool order (above)? Can be done? Must exiftool be called two times?
Yes, this requires two commands. But you can do this with do it with another
-execute in your command.
Sorry Phil, after expending more than two hours trying to integrate it into my command, finally give up. I think the problem is in the DIR/*-1.jpg part. Because I'm getting:
Error: File not found - ./*-1.jpg
I just can't get ExifTool to find the correct file to rename... :-[
Are there any files with names that end in "-1.jpg" in the current directory? Make sure the "*" is not quoted. What was your exact command? What OS are you running?
- Phil
Yes, there are. Your code is correct, it's working, it's just I don't know how to integrate it into my current ExifTool order using another one -execute, this is the problem:
exiftool \
-d '%Y-%m-%d %H.%M.%S' -ext 'arw' -ext 'dng' -ext 'jpg' -ext 'jpeg' -ext 'nef' -ext 'tif' -ext 'tiff' -IPTC:all= -XMP:all= -Photoshop:all= \
'-FileName<${FileModifyDate}%-c.${FileTypeExtension}' '-FileName<${MetadataDate}%-c.${FileTypeExtension}' \
'-FileName<${ModifyDate}%-c.${FileTypeExtension}' '-FileName<${CreateDate}%-c.${FileTypeExtension}' '-FileName<${DateTimeOriginal}%-c.${FileTypeExtension}' \
'-FileName<${ModifyDate}.${SubSecTime;$_=substr($_.'0',0,2)}.${FileTypeExtension}' \
'-FileName<${CreateDate}.${SubSecTimeDigitized;$_=substr($_.'0',0,2)}.${FileTypeExtension}' \
'-FileName<${DateTimeOriginal}.${SubSecTimeOriginal;$_=substr($_.'0',0,2)}.${FileTypeExtension}' \
-execute \
-d '%Y-%m-%d %H.%M.%S' -ext 'png' -IPTC:all= -XMP:all= -Photoshop:all= \
'-FileName<${FileModifyDate}%-c.${FileTypeExtension}' '-FileName<${MetadataDate}%-c.${FileTypeExtension}' '-FileName<${DateCreated}%-c.${FileTypeExtension}' \
-execute \
-d '%Y-%m-%d %H.%M.%S' -ext 'avi' \
-api largefilesupport=1 '-FileName<${DateTimeOriginal}%-c.${FileTypeExtension}' \
-execute \
-d '%Y-%m-%d %H.%M.%S' -ext 'mov' -ext 'mp4' \
-api largefilesupport=1 '-FileName<${CreateDate}%-c.${FileTypeExtension}' '-FileName<${CreationDate}%-c.${FileTypeExtension}' \
-execute \
-ext 'arw' -ext 'dng' -ext 'jpg' -ext 'jpeg' -ext 'nef' -ext 'tif' -ext 'tiff' -ext 'png' -ext 'avi' -ext 'mov' -ext 'mp4' \
-if '${FileModifyDate;tr/0-9//cd;s/^(\d{14}).*/$1/} ne ${FileName;tr/0-9//cd;s/^(\d{14}).*/$1/}' '-FileModifyDate<FileName' \
-common_args -r -overwrite_original \
.
What was the command you tried?
$ ls -l
total 4326
-rw-r--r-- 1 user group 1107409 1 ene 1990 2002-12-27 22.14.32-1.jpg
-rw-r--r-- 1 user group 1107409 1 ene 1990 2002-12-27 22.14.32.jpg
$ exiftool "-filename=%-.2f-0.%e" -srcfile %d%-.2f.%e ./*-1.jpg
1 image files updated
$ ls -l
total 4326
-rw-r--r-- 1 user group 1107409 1 ene 1990 2002-12-27 22.14.32-0.jpg
-rw-r--r-- 1 user group 1107409 1 ene 1990 2002-12-27 22.14.32-1.jpg
I meant the one that didn't work.
This is my code, of course don't work ;D
exiftool \
-d '%Y-%m-%d %H.%M.%S' -ext 'arw' -ext 'dng' -ext 'jpg' -ext 'jpeg' -ext 'nef' -ext 'tif' -ext 'tiff' -IPTC:all= -XMP:all= -Photoshop:all= \
'-FileName<${FileModifyDate}%-c.${FileTypeExtension}' '-FileName<${MetadataDate}%-c.${FileTypeExtension}' \
'-FileName<${ModifyDate}%-c.${FileTypeExtension}' '-FileName<${CreateDate}%-c.${FileTypeExtension}' '-FileName<${DateTimeOriginal}%-c.${FileTypeExtension}' \
'-FileName<${ModifyDate}.${SubSecTime;$_=substr($_.'0',0,2)}.${FileTypeExtension}' \
'-FileName<${CreateDate}.${SubSecTimeDigitized;$_=substr($_.'0',0,2)}.${FileTypeExtension}' \
'-FileName<${DateTimeOriginal}.${SubSecTimeOriginal;$_=substr($_.'0',0,2)}.${FileTypeExtension}' \
-execute \
-d '%Y-%m-%d %H.%M.%S' -ext 'png' -IPTC:all= -XMP:all= -Photoshop:all= \
'-FileName<${FileModifyDate}%-c.${FileTypeExtension}' '-FileName<${MetadataDate}%-c.${FileTypeExtension}' '-FileName<${DateCreated}%-c.${FileTypeExtension}' \
-execute \
-d '%Y-%m-%d %H.%M.%S' -ext 'avi' \
-api largefilesupport=1 '-FileName<${DateTimeOriginal}%-c.${FileTypeExtension}' \
-execute \
-d '%Y-%m-%d %H.%M.%S' -ext 'mov' -ext 'mp4' \
-api largefilesupport=1 '-FileName<${CreateDate}%-c.${FileTypeExtension}' '-FileName<${CreationDate}%-c.${FileTypeExtension}' \
-execute \
-ext 'arw' -ext 'dng' -ext 'jpg' -ext 'jpeg' -ext 'nef' -ext 'tif' -ext 'tiff' -ext 'png' -ext 'avi' -ext 'mov' -ext 'mp4' \
-if '${FileModifyDate;tr/0-9//cd;s/^(\d{14}).*/$1/} ne ${FileName;tr/0-9//cd;s/^(\d{14}).*/$1/}' '-FileModifyDate<FileName' \
-execute \
-ext 'arw' -ext 'dng' -ext 'jpg' -ext 'jpeg' -ext 'nef' -ext 'tif' -ext 'tiff' -ext 'png' -ext 'avi' -ext 'mov' -ext 'mp4' \
exiftool "-filename=%-.2f-0.%e" -srcfile %d%-.2f.%e ./*-1.jpg
-common_args -r -overwrite_original \
.
Two problems.
1. You added an "exiftool" that shouldn't be there.
2. You want to process different directories with this command, so the -common_args don't apply.
Try this:
exiftool \
-d '%Y-%m-%d %H.%M.%S' -ext 'arw' -ext 'dng' -ext 'jpg' -ext 'jpeg' -ext 'nef' -ext 'tif' -ext 'tiff' -IPTC:all= -XMP:all= -Photoshop:all= \
'-FileName<${FileModifyDate}%-c.${FileTypeExtension}' '-FileName<${MetadataDate}%-c.${FileTypeExtension}' \
'-FileName<${ModifyDate}%-c.${FileTypeExtension}' '-FileName<${CreateDate}%-c.${FileTypeExtension}' '-FileName<${DateTimeOriginal}%-c.${FileTypeExtension}' \
'-FileName<${ModifyDate}.${SubSecTime;$_=substr($_.'0',0,2)}.${FileTypeExtension}' \
'-FileName<${CreateDate}.${SubSecTimeDigitized;$_=substr($_.'0',0,2)}.${FileTypeExtension}' \
'-FileName<${DateTimeOriginal}.${SubSecTimeOriginal;$_=substr($_.'0',0,2)}.${FileTypeExtension}' \
-r -overwrite_original . -execute \
-d '%Y-%m-%d %H.%M.%S' -ext 'png' -IPTC:all= -XMP:all= -Photoshop:all= \
'-FileName<${FileModifyDate}%-c.${FileTypeExtension}' '-FileName<${MetadataDate}%-c.${FileTypeExtension}' '-FileName<${DateCreated}%-c.${FileTypeExtension}' \
-r -overwrite_original . -execute \
-d '%Y-%m-%d %H.%M.%S' -ext 'avi' \
-api largefilesupport=1 '-FileName<${DateTimeOriginal}%-c.${FileTypeExtension}' \
-r -overwrite_original . -execute \
-d '%Y-%m-%d %H.%M.%S' -ext 'mov' -ext 'mp4' \
-api largefilesupport=1 '-FileName<${CreateDate}%-c.${FileTypeExtension}' '-FileName<${CreationDate}%-c.${FileTypeExtension}' \
-r -overwrite_original . -execute \
-ext 'arw' -ext 'dng' -ext 'jpg' -ext 'jpeg' -ext 'nef' -ext 'tif' -ext 'tiff' -ext 'png' -ext 'avi' -ext 'mov' -ext 'mp4' \
-if '${FileModifyDate;tr/0-9//cd;s/^(\d{14}).*/$1/} ne ${FileName;tr/0-9//cd;s/^(\d{14}).*/$1/}' '-FileModifyDate<FileName' \
-r -overwrite_original . -execute \
-ext 'arw' -ext 'dng' -ext 'jpg' -ext 'jpeg' -ext 'nef' -ext 'tif' -ext 'tiff' -ext 'png' -ext 'avi' -ext 'mov' -ext 'mp4' \
"-filename=%-.2f-0.%e" -srcfile %d%-.2f.%e ./*-1.*
- Phil
Thanks Phil, your code is working perfectly, but only in .. When I try to hardcode a path in the -d option (for using the code in a shell script), two problems arise:
1.- The code to sync the FileName to the FileModifyDate, breaks
2.- Error: File not found - ./*-1.*, the rename breaks as well
This is the code I used, modified my me:
exiftool \
-d '/Users/user/Pictures/%Y/%m/%Y-%m-%d %H.%M.%S' -ext 'arw' -ext 'dng' -ext 'jpg' -ext 'jpeg' -ext 'nef' -ext 'tif' -ext 'tiff' -IPTC:all= -XMP:all= -Photoshop:all= \
'-FileName<${FileModifyDate}%-c.${FileTypeExtension}' '-FileName<${MetadataDate}%-c.${FileTypeExtension}' \
'-FileName<${ModifyDate}%-c.${FileTypeExtension}' '-FileName<${CreateDate}%-c.${FileTypeExtension}' '-FileName<${DateTimeOriginal}%-c.${FileTypeExtension}' \
'-FileName<${ModifyDate}.${SubSecTime;$_=substr($_.'0',0,2)}.${FileTypeExtension}' \
'-FileName<${CreateDate}.${SubSecTimeDigitized;$_=substr($_.'0',0,2)}.${FileTypeExtension}' \
'-FileName<${DateTimeOriginal}.${SubSecTimeOriginal;$_=substr($_.'0',0,2)}.${FileTypeExtension}' \
-r -overwrite_original /Users/user/Pictures/@input -execute \
-d '/Users/user/Pictures/Screenshots/%Y/%m/%Y-%m-%d %H.%M.%S' -ext 'png' -IPTC:all= -XMP:all= -Photoshop:all= \
'-FileName<${FileModifyDate}%-c.${FileTypeExtension}' '-FileName<${MetadataDate}%-c.${FileTypeExtension}' '-FileName<${DateCreated}%-c.${FileTypeExtension}' \
-r -overwrite_original /Users/user/Pictures/@input -execute \
-d '/Users/user/Pictures/%Y/%m/%Y-%m-%d %H.%M.%S' -ext 'avi' \
-api largefilesupport=1 '-FileName<${DateTimeOriginal}%-c.${FileTypeExtension}' \
-r -overwrite_original /Users/user/Pictures/@input -execute \
-d '/Users/user/Pictures/%Y/%m/%Y-%m-%d %H.%M.%S' -ext 'mov' -ext 'mp4' \
-api largefilesupport=1 '-FileName<${CreateDate}%-c.${FileTypeExtension}' '-FileName<${CreationDate}%-c.${FileTypeExtension}' \
-r -overwrite_original /Users/user/Pictures/@input -execute \
-ext 'arw' -ext 'dng' -ext 'jpg' -ext 'jpeg' -ext 'nef' -ext 'tif' -ext 'tiff' -ext 'png' -ext 'avi' -ext 'mov' -ext 'mp4' \
-if '${FileModifyDate;tr/0-9//cd;s/^(\d{14}).*/$1/} ne ${FileName;tr/0-9//cd;s/^(\d{14}).*/$1/}' '-FileModifyDate<FileName' \
-r -overwrite_original /Users/user/Pictures/@input -execute \
-ext 'arw' -ext 'dng' -ext 'jpg' -ext 'jpeg' -ext 'nef' -ext 'tif' -ext 'tiff' -ext 'png' -ext 'avi' -ext 'mov' -ext 'mp4' \
"-filename=%-.2f-0.%e" -srcfile %d%-.2f.%e ./*-1.*
The "./*-1.*" won't work after you have moved the files to "/mnt/zfast/Users/vicmarto/Pictures/Fototeca/%Y/%m/".
Unfortunately this is complicated because you have %Y/%m in the directory name. You could change "./*-1.*" to this:
"/mnt/zfast/Users/vicmarto/Pictures/Fototeca/*/*/*-1.*"
But that would unnecessarily scan all of your pictures, and not only the ones that you have just renamed.
I can't think of a good way around this.
- Phil
I see now where is the problem, well don't worry, thank you very much anyway for your patience ;)
About the other problem? It's possible to make the "code to sync the FileName to the FileModifyDate" work when an output directory is hardcoded into the -d option?
-d '/Users/user/Pictures/%Y/%m/%Y-%m-%d %H.%M.%S'
Hardcoded is fine, but %Y/%m is not hard coded... it uses whatever date/time is contained in the file. I already provided the only work-around I can think of for this case.
- Phil
Quote from: Phil Harvey on February 27, 2019, 11:05:20 AM
Hardcoded is fine, but %Y/%m is not hard coded... it uses whatever date/time is contained in the file. I already provided the only work-around I can think of for this case.
- Phil
Ok... I see now where is the problem. A big thanks fo you and StarGeek!!
I want from here to recommend ExifTool to everyone, regardless of the workflow you use, or the photo management software you use: ExifTool is perfect for you. To ordering, importing and renaming photos. It is very flexible and powerful, and the support is top notch !!