Hi all, you can probably guess I'm pretty new to exiftool. :D For some reason, I just can't get my head around it, but it seems like this is the only application that will perform the task I need. My problem is this:
All my image files follow the same file name pattern 'YY-MM-DD HHMMSS'. For example, for a photo taken today at 13:50 the file would be named '16-07-21 135032'. All the dates on the file names are correct but the exif capture date is not. If possible, I would like all dates shown on the exif data including the created and modified dates to be the same. So I was wondering, would there be a way to change the dates shown in exif data to match the file name?
You can use this command to set the common EXIF date/times from your file names:
exiftool "-alldates<20$filename" DIR
This should work assuming that all years are 2000 or later. Because you only have 2 digits in your year, I have added "20" before the file name to complete the 4-digit year.
- Phil
That works perfectly, thanks a lot Phil. I was just missing the '20'. ;D
I'm new here also - but this post is the closest solution I've found for what I would like to do with ExifTool... EXCITING!
I catalog all my photo files inside a folder named by date taken (YYYY-MM-DD-description). I would like to set / create all EXIF dates using the date in the foldername. Sometimes the EXIF dates match but sometimes scanned photos may have inaccurate EXIF dates or no EXIF dates at all. Additionally, some photo editors may end up stripping the EXIF data. Can ExifTool accomplish this on a batch basis for all files inside a folder?
It would be a bonus if ExifTool could also set all the file dates (non EXIF) as well. (Bonus??? Hmmm... maybe like a dream come true!)
Why do this? Well I'm exploring photo storage in the cloud and it would be nice if the photos were automatically sorted by date in the cloud. It seems that there is no consistency across cloud solutions as to what date is used for sorting. If all dates (file & EXIF) were the same then sorting should be correct in any cloud.
The bulk of my files are JPG and it seems that ExifTool has no problem targeting those files. What happens with MOV or MP4 video files or with PNG files?
Any assistance towards a solution would really be appreciated!
Sure, a command like this may do what you want:
exiftool "-alldates<${directory}${filemodifydate;s/.* //}" "-alldates<${directory}${modifydate;s/.* //}" "-alldates<${directory}${createdate;s/.* //}" "-alldates<${directory}${datetimeoriginal;s/.* //}" -r DIR
Where DIR is the directory containing all of the subdirectories named by date.
The command is so long because I have tried to fill in the time with any other available time, in order of precedence: 1) DateTimeOriginal, 2) CreateDate, 3) ModifyDate, 4) FileModifyDate.
If you just want to use a fixed time instead, the command would be a lot simpler:
exiftool "-alldates<$directory 00:00:00" -r DIR
- Phil
Phil,
Thank you so much for your reply! This certainly gets me started on using ExifTools - your short command line seems to do the job - VERY impressive! As for the long command line, well, that will be a challenge for any newbie to decipher! :o)
I will do some digging in your documentation but I think I should be able to reset the OS file dates as well (I see alldates does the EXIF dates only). Perhaps I will challenge myself to define a new custom tag which includes EXIF and OS dates in one tag name! Can you point me to any documentation that lists value names (i.e. $directory, $filename, etc) and tag names (i.e. alldates, filemodifydate, etc)?
Thanks again Phil - for your reply and for your software!
Directory, FileName, FileModifyDate, are all tag names (although these are special "pseudo" system tags). The complete tag name documentation is here (https://exiftool.org/TagNames/index.html), but specifically it is the Extra Tags (https://exiftool.org/TagNames/Extra.html) that you are mainly interested in. AllDates is a Shortcut Tag (https://exiftool.org/TagNames/Shortcuts.html). Also see the sample config file (https://exiftool.org/config.html) if you want to define your own shortcuts.
- Phil
Great reference material! This should get me going.
Thanks again for taking the time to assist yet another newbie - this little bit of help made a big difference in getting started with ExifTool!
Richard
Phil,
I seem to be having a problem with the file directory structure interfering with what I am trying to accomplish and wonder if there is a way around the problem.
I use a directory structure like this: Photos\YYYY\YYYY-MM\YYYY-MM-DD with photos being stored in the lowest folders only.
When I try to run the command: exiftools "-alldates<$directory 00:00:00" -r C:\Photos
I'm getting incorrect dates... it seems the date is being set from the full directory name instead of the immediate directory name for each file. Is there a way to force ExifTool to use the immediate directory name only? (I'm even getting illegal dates written with months >12). Do I need to run the command in each folder holding the files instead of in the folders in higher levels? (That would be a lot more work.)
Additionally, when I try running: exiftools "-FileModifyDate<$directory 00:00:00" -r C:\Photos
I get a warning about no writable tags but the list of tags indicates that FileModifyDate is writable. I have used an administrator level command window.
Clearly, I have some work to do before "earning my wings" for ExifTool...
Try using :
exiftools "-alldates<${directory;s/.*\/(.*)/$1/} 00:00:00" -r C:\Photos
StarGeek,
Thank you so much for your solution! The one command changed the EXIF dates flawlessly across 147 directories and 2,158 image files... WOW!
I retried it for the FileModifyDate and FileCreateDate tags and, for the most part, those tags were also changed correctly. I did notice a minor glitch when I moved from the 2013-03-09 folder to the 2013-03-12 folder. The EXIF dates were consistent all the way through but the file dates started to get tagged one hour less than the directory date (i.e. 2013-03-11 23:00:00 instead of 2013-03-12 00:00:00) - kind of weird. This happened to all the later dates as well. Not really a big deal for me - just strange.
Would you be able to point me to some documentation that explains at how you arrived at "{directory;s/.*\/(.*)/$1/}" instead of "directory"? I would love to understand this.
BTW, my typos in my previous message... "exiftools" should be "exiftool" of course.
THANKS again!
Quote from: RRRichard on November 11, 2016, 07:27:46 PM
the file dates started to get tagged one hour less than the directory date (i.e. 2013-03-11 23:00:00 instead of 2013-03-12 00:00:00) - kind of weird.
This is likely somehow related to the known Windows time zone bug. Windows doesn't treat time zones properly, and it causes all sorts of problems like this.
- Phil
Thanks for the help here to solve my problem. Looks like I might have to get my Perl wings alongside getting my ExifTool wings (re. StarGeek's solution). :D
Quote from: RRRichard on November 11, 2016, 07:27:46 PM
Would you be able to point me to some documentation that explains at how you arrived at "{directory;s/.*\/(.*)/$1/}" instead of "directory"? I would love to understand this.
Phil calls it "Advanced Formatting" and you can find a little info under the
-p (http://www.exiftool.org/exiftool_pod.html#str) option docs. It's basically putting some perl code, often perl regular expression (regex) substitution, into the command line. Teaching perl and regex is a bit beyond the scope of this forum, but there are plenty of resources out on the web. In most cases, problems can be solved with just knowing some regex.
My suggested resources for learning regex are Regular-Expressions.info (http://www.regular-expressions.info/) for the basics and RegEx101 (https://regex101.com/) for testing expressions out. One of the nice things about RegEx101 is that it'll give you a step by step explanation in the upper right corner. For example, here's the regex (https://regex101.com/r/cdyGH2/1) I used.
StarGeek,
That's perfect - it should get me started - much appreciated!
Thanks again,
Richard
Hello.
This is what i need. But i didn't got it. I want to set exif dates with the date written it the filename.
I believe i will need a command like exiftool "-alldates<20$filename" -r DIR but my filenames are not date exactly.
My file pattern: 18F01-5-29(17-9).jpg where 18F is just picture number. Then i have YY-MM-DD(hh-mm). and month is not always 2-digit like in this example.
How can i tell exiftool the pattern? I have no idea how to ignore 3 firsts characters and how to treat the 1 or 2 digit month.
Thank's in advance.
Try this:
exiftool "-alldates<20${filename;s/^...//}" -r DIR
I think this should work if it is always 3 characters before the year.
- Phil
Quote from: Phil Harvey on February 04, 2017, 09:24:01 PM
Try this:
exiftool "-alldates<20${filename;s/^...//}" -r DIR
I think this should work if it is always 3 characters before the year.
- Phil
You are right. It worked. So i had run the same command with on more dot and one less dot as numbers got also 2 and 4 digits sometimes. I couldn't imagine the tool was so flexible to understand the different date mask (since my filenames do not use the left 0 when day and month have only one digit).
Also i had to change the quotes like your signature warns. (I use Linux). Already finishing to organize my pictures. This is the last big effort needed. The legacy cameras that makes a mess.
Thank you very much.
I am sure we could find a pattern to match all cases if the prefix has a variable size. Maybe something like this:
exiftool "-alldates<20${filename;s/^\d+.//}" -r DIR
which should handle a variable number of digits then remove one extra character.
BTW, FAQ 5 (https://exiftool.org/faq.html#Q5) details the date/time formats the ExifTool accepts.
- Phil
Don't get bother about it. It's not a problem to run 3 commands. I will try this suggestion latter but i had already fixed all i needed.
Thank's a lot. I really appreciated your help.
Quote from: Phil Harvey on February 05, 2017, 09:42:04 AM
I am sure we could find a pattern to match all cases if the prefix has a variable size. Maybe something like this:
exiftool "-alldates<20${filename;s/^\d+.//}" -r DIR
which should handle a variable number of digits then remove one extra character.
BTW, FAQ 5 (https://exiftool.org/faq.html#Q5) details the date/time formats the ExifTool accepts.
- Phil
It worked for 3 and 4 digits. Not for 2. I took a look at the FAQ and others but find only one reference to s/ and looks like it's pearl, what i know nothing.
I couldn't imagine the tool was so flexible to understand the different date mask (since my filenames do not use the left 0 when day and month have only one digit).
Also i had to change the quotes like your signature warns. (I use Linux). Already finishing to organize my pictures. This is the last big effort needed. The legacy cameras that makes a mess.
Thank you very much.
Quote from: quirino1977 on February 11, 2017, 12:15:40 PM
It worked for 3 and 4 digits. Not for 2. I took a look at the FAQ and others but find only one reference to s/ and looks like it's pearl, what i know nothing.
Its indeed a piece of perl that substitutes the first digits of the filename string. It matches 1 or more digits + one additional character so if you say it didn't work on files with 2 starting digits, that shouldn't be the case. What was the name of the file that didn't work? My guess is it simply followed a slightly different naming scheme.
Cheers,
Hayo
Had not worked for 1F01-4-4(3-1).jpg.
Worked for 49F01-5-1(10-46).jpg and 114F01-8-18(17-15).jpg.
user@user-linux:~/Downloads/Image-ExifTool-10.41$ ls -l /home/user/Desktop/test/
-rw-rw-r-- 1 user user 45089 Fev 11 16:29 108F01-8-18(16-32).jpg
-rw-rw-r-- 1 user user 46153 Fev 11 14:58 2F01-4-4(3-2).jpg
-rw-rw-r-- 1 user user 47395 Fev 11 16:29 83F01-8-18(16-22).jpg
user@linux:~/Downloads/Image-ExifTool-10.41$ ./exiftool '-alldates<20${filename;s/^d+.//}' -r /home/user/Desktop/test/
Warning: No writable tags set from /home/user/Desktop/test/2F01-4-4(3-2).jpg
1 directories scanned
2 image files updated
1 image files unchanged
user@user-linux:~/Downloads/Image-ExifTool-10.41$ ls -l /home/user/Desktop/test/
-rw-rw-r-- 1 user user 45089 Fev 11 16:29 108F01-8-18(16-32).jpg
-rw-rw-r-- 1 user user 45089 Fev 11 14:40 108F01-8-18(16-32).jpg_original
-rw-rw-r-- 1 user user 46153 Fev 11 14:58 2F01-4-4(3-2).jpg
-rw-rw-r-- 1 user user 47395 Fev 11 16:29 83F01-8-18(16-22).jpg
-rw-rw-r-- 1 user user 47395 Fev 11 14:38 83F01-8-18(16-22).jpg_original
user@user-linux:~/Downloads/Image-ExifTool-10.41$ ./exiftool '-alldates<20${filename;s/^..//}' -r /home/user/Desktop/test/
Warning: No writable tags set from /home/user/Desktop/test/108F01-8-18(16-32).jpg
Warning: No writable tags set from /home/user/Desktop/test/83F01-8-18(16-22).jpg
1 directories scanned
1 image files updated
2 image files unchanged
user@user-linux:~/Downloads/Image-ExifTool-10.41$ ls -l /home/user/Desktop/test/
-rw-rw-r-- 1 user user 45089 Fev 11 16:29 108F01-8-18(16-32).jpg
-rw-rw-r-- 1 user user 45089 Fev 11 14:40 108F01-8-18(16-32).jpg_original
-rw-rw-r-- 1 user user 46153 Fev 11 16:32 2F01-4-4(3-2).jpg
-rw-rw-r-- 1 user user 46153 Fev 11 14:58 2F01-4-4(3-2).jpg_original
-rw-rw-r-- 1 user user 47395 Fev 11 16:29 83F01-8-18(16-22).jpg
-rw-rw-r-- 1 user user 47395 Fev 11 14:38 83F01-8-18(16-22).jpg_original
There aren't enough numbers for the time in some filenames. Try this (add a couple of zeros for missing minutes and seconds):
exiftool '-alldates<20${filename;s/^\d+.//} 0 0' -r /home/user/Desktop/test/
- Phil
Hi,
I just discovered this software and I am really impressed.
This topic saved me a lot of time, so thanks in advanced for your help.
However, when applying: "exiftool "-alldates<$filename" DIR", all the exif dates are changed but windows dates, as Date Created or Date Modified, are not changed.
Is there any way to change ALL dates, not only exif dates, but also windows dates? (created, modified, etc...)
Thanks in advanced.
Try this:
exiftool "-alldates<filename" "-filecreatedate<filename" "-filemodifydate<filename" DIR
- Phil
I have a slightly different issue.
I am restoring some of the old pictures from phones, and dates in exif are incorrect or not there at all. File name is the only source I can use, however, the file name is in following format 01-01-08_0022.jpg "mm-dd-yy_HHMM.jpg". Is there a way to set -alldates to use the file name in the following format? Any way I can convert filename to proper date format? Perhaps I can shift date elements in a filename around.
thank you very much.
Try this, assuming no pictures taken before the year 2000. It also places the seconds at 00, since the seconds value isn't in the filename.
exiftool "-alldates<${filename;s/(\d\d)-(\d\d)-(\d\d)_(\d{4})/20$3-$2-$1_${4}00/}" FileOrDir
Example output:
C:\>exiftool -alldates "X:\!temp\01-01-08_0022.jpg"
Date/Time Original : 2003:03:03 03:03:03
C:\>exiftool "-alldates<${filename;s/(\d\d)-(\d\d)-(\d\d)_(\d{4})/20$3-$2-$1_${4}00/}" "X:\!temp\01-01-08_0022.jpg"
1 image files updated
C:\>exiftool -alldates "X:\!temp\01-01-08_0022.jpg"
Date/Time Original : 2008:01:01 00:22:00
Create Date : 2008:01:01 00:22:00
Modify Date : 2008:01:01 00:22:00
Thanks a lot! That's exactly what I needed.
Quote from: RRRichard on November 11, 2016, 06:04:01 PM
Phil,
I seem to be having a problem with the file directory structure interfering with what I am trying to accomplish and wonder if there is a way around the problem.
I use a directory structure like this: Photos\YYYY\YYYY-MM\YYYY-MM-DD with photos being stored in the lowest folders only.
When I try to run the command: exiftools "-alldates<$directory 00:00:00" -r C:\Photos
I'm getting incorrect dates... it seems the date is being set from the full directory name instead of the immediate directory name for each file. Is there a way to force ExifTool to use the immediate directory name only? (I'm even getting illegal dates written with months >12). Do I need to run the command in each folder holding the files instead of in the folders in higher levels? (That would be a lot more work.)
Additionally, when I try running: exiftools "-FileModifyDate<$directory 00:00:00" -r C:\Photos
I get a warning about no writable tags but the list of tags indicates that FileModifyDate is writable. I have used an administrator level command window.
Clearly, I have some work to do before "earning my wings" for ExifTool...
Hi,
I'm new here. This sounds like my situation but I don't understand coding. Is there a step by step guide? I have thousands and thousands of pictures that I want to change the dates for. I downloaded your tool but I don't understand how to use it. But this sounds like what I'd like to do. Change the exif dates to the filename dates. Can someone help?
Stacy
Hi Stacy,
Try reading this post (https://exiftool.org/forum/index.php/topic,4888.0.html) to get started. Also, there is this unfinished ExifTool for dummies (https://exiftool.org/dummies.html) page.
- Phil
I put this really long string in - exiftool "-alldates<${directory}${filemodifydate;s/.* //}" "-alldates<${directory}${modifydate;s/.* //}" "-alldates<${directory}${createdate;s/.* //}" "-alldates<${directory}${datetimeoriginal;s/.* //}" -r DIR
And it's doing something
This is a couple examples of the way my file is structured if that helps. I have a bunch of files where I don't know the exact date and substituted the day for "xx". I seem to be getting errors on those. Is there a way I can specify the date I want those to be one by one? Also it only seems to be giving errors on the Modifydate. Not sure if everything else is working
J:\Pictures\1986\12-25-86 - Christmas
J:\Pictures\1994\05-01-94 - Camping trip
Update: I stopped it from running. I went to look at a folder and all it seemed to be doing was adding another file on. The dates weren't changed on anything that it had gone through already. I added another attachment for you to see.
Try running it on one file with the -v2 option to see some details about what it is doing.
- Phil
Quote from: Phil Harvey on November 25, 2017, 05:16:33 PM
Try running it on one file with the -v2 option to see some details about what it is doing.
- Phil
What does that mean? What is a -v2 option? I want to change all the dates I believe
I meant this:
exiftool "-alldates<${directory}${filemodifydate;s/.* //}" "-alldates<${directory}${modifydate;s/.* //}" "-alldates<${directory}${createdate;s/.* //}" "-alldates<${directory}${datetimeoriginal;s/.* //}" -r -v2 FILE
- Phil
Hello. I'm not a code guy so some guidance is greatly appreciated. It seems that my concern has been addressed in this thread, but I'm hoping I can get a precise copy and paste command to perform this.
I have installed the ExifTool application on my MAC.
Issue: Embedded dates are all wrong after copying them from platform to platform. Thankfully the date in the filename is correct. The filename format is IMG-20141222-WA0054.jpg
Required: Copy the date from filename to the exif info. I've got 2500+ pictures in one folder on my laptop.
Can someone please provide me with a command I can copy paste on my MAC to execute this?
Again. Forgive the ignorance. Just a guy who messed up 2500+ family pics, and trying to get back on the wife's good side.
Jerry
Hi Jerry,
Embedded dates should not change if you are just copying the file across platforms.
However, filesystem dates are likely to change. To set the file system modification date from the file name, try this:
exiftool "-filemodifydate<filename" DIR
Note that this will also set the time, which will be 00:54 with your example file name.
- Phil
Thanks Phil. I'm an idiot clearly. All the images are in a folder called SD on the harddrive called HDD6. So the directory should be HDD6/SD right?
I am getting an error. I've attached a screenshot of the terminal window.
Thanks,
Jerry
Instead of typing the folder name, try dragging and dropping the folder onto the Terminal window.
- Phil
Hello,
I'm getting an error for some reason which is not letting me update the date information. command log is below. Can you assist? I'm trying to update all Dates with the date in the filename. not sure what the issue is.
C:\Users\Dominic>exiftool "-alldates<filename" C:\Testbatch\IMG_20140508_224323.
jpg
Warning: Invalid EXIF text encoding for UserComment - C:/Testbatch/IMG_20140508_
224323.jpg
Warning: [minor] Entries in IFD0 were out of sequence. Fixed. - C:/Testbatch/IMG
_20140508_224323.jpg
Error: Error reading OtherImageStart data in ExifIFD - C:/Testbatch/IMG_20140508
_224323.jpg
0 image files updated
1 files weren't updated due to errors
C:\Users\Dominic>exiftool "-alldates<filename" -v2 C:\Testbatch\IMG_20140508_224
323.jpg
======== C:/Testbatch/IMG_20140508_224323.jpg
Setting new values from C:/Testbatch/IMG_20140508_224323.jpg
Writing MIE-Doc:DateTimeOriginal
Writing Kodak:DateTimeOriginal if tag exists
Writing CanonRaw:DateTimeOriginal if tag exists
Writing Reconyx:DateTimeOriginal if tag exists
Writing XMP-exif:DateTimeOriginal if tag exists
Writing ExifIFD:DateTimeOriginal
Writing PNG:CreateDate
Writing QuickTime:CreateDate if tag exists
Writing PDF:CreateDate if tag exists
Writing PostScript:CreateDate
Writing MIE-Doc:CreateDate
Writing XMP-xmp:CreateDate if tag exists
Writing ExifIFD:CreateDate
Writing PDF:ModifyDate if tag exists
Writing PNG:ModifyDate
Writing PostScript:ModifyDate
Writing MIE-Doc:ModifyDate
Writing QuickTime:ModifyDate if tag exists
Writing XMP-xmp:ModifyDate if tag exists
Writing IFD0:ModifyDate
Warning: Invalid EXIF text encoding for UserComment - C:/Testbatch/IMG_20140508_
224323.jpg
Rewriting C:/Testbatch/IMG_20140508_224323.jpg...
Editing tags in: APP0 APP1 CIFF ExifIFD IFD0 JFIF MIE-Doc MakerNotes PDF PNG P
ostScript QuickTime XMP
Creating tags in: APP1 ExifIFD IFD0 MIE-Doc PNG PostScript
JPEG APP1 (831 bytes):
Rewriting IFD0
Warning = [minor] Entries in IFD0 were out of sequence. Fixed.
- IFD0:ModifyDate = '1969:12:31 16:00:00'
+ IFD0:ModifyDate = '2014:05:08 22:43:23'
Rewriting ExifIFD
+ ExifIFD:DateTimeOriginal = '2014:05:08 22:43:23'
+ ExifIFD:CreateDate = '2014:05:08 22:43:23'
Error = Error reading OtherImageStart data in ExifIFD
Warning: [minor] Entries in IFD0 were out of sequence. Fixed. - C:/Testbatch/IMG
_20140508_224323.jpg
Error: Error reading OtherImageStart data in ExifIFD - C:/Testbatch/IMG_20140508
_224323.jpg
0 image files updated
1 files weren't updated due to errors
C:\Users\Dominic>
Hi Dominic,
The metadata in your image is seriously messed up if it has OtherImage tags in the ExifIFD. See FAQ 20 (https://exiftool.org/faq.html#Q20) for how to repair this.
- Phil
I scanned old photos where the filename structure is YYYY-MM-DD or YYYY-MM, depending on whether I knew the exact day. In order to keep the photos in order by filename, I sometimes added a letter after the month. See examples of the three kinds of ways photos are named:
1983-04 Pre-birthday setup 001.jpg
1983-04 Pre-birthday setup 002.jpg
1983-04b Birthday 001.jpg
1983-04b Birthday 002.jpg
1987-09-15 Baseball game 001.jpg
1987-09-15 Baseball game 002.jpg
QUESTION: Can you recommend a command line to enable me to change the creation day and make it flexible enough that it won't require a "DD" information if I haven't included it. (Or just default the DD to, "01" if nothing is provided.
Thanks.
What do you mean by "change the creation day"? To set the fileCreateDate from the fileName, you could do this:
exiftool "-filecreatedate<$filename 01 00:00:00" DIR
This would take as much of the date/time from the file name as possible, then add DD HH:MM:SS = "01 00:00:00" if only YY:MM were given, or add HH:MM:SS = "01:00:00" if YY:MM:DD were given.
- Phil
The image count number is going to mixed in there as well, so that needs to be taken into account or stripped away.
Right. Maybe like this:
exiftool "-filecreatedate<${filename;s/ .*//} 01 00:00:00" DIR
It worked! The photos with the same month (1984-02) have the same creation date (1984-02-01 12:00:00AM) Is there way to make the add a second between the photos to try to mimic the filename numbering? The idea is to "trick" Google Photos into putting the photos into the correct order. Otherwise, I fear Google Photos will jumble the order as it doesn't seem to pay any attention to the filename.
See this post (https://exiftool.org/forum/index.php/topic,5621.msg27394.html#msg27394). You've already done step one.
For future me, here are the two steps that worked (thanks to Phil Harvey and Star Geek):
1. Scan photos
2. Name them like this: 1984-02 Birthday 001.tif, 1984-02 Birthday 002.tif, 1989-08 Vacation 001.tif, etc.
3. Place exiftool in Windows system directory (follow installation info)
4. Open Command prompt (in Windows 10)
5. Type the following: exiftool "-filecreatedate<${filename;s/ .*//} 01 00:00:00" c:/testphotos (where c:/testphotos is the location of the folder... folder with spaces seems more troublefree, but need to look into this...)
6. Type the following: exiftool "-datetimeoriginal+<0:$filesequence" c:/testphotos
This changes the creation date and forces Google photos to place the images in the correct order.
I have tried a bunch, an I think I might have gotten close, but then started to fall behind. My problem seems so much more simple then the above, but I can't get it to work.
I don't have folders, I have all my images in one folder with only the year (while scanning I had no idea on the finer details).
JPG Name:
1967 Uncle Frank
I would like to take that date (year) and out it in the DateTaken Meta. Date taken seems to be better than Date created, would you disagree? At least with date created I have a record when I scanned it.
Assuming you mean "DateTimeOriginal" for what you call "DateTaken", you could try this:
exiftool "-datetimeoriginal<${filename;$_=/^(\d{4})/ ? $1 . ':01:01 00:00:00' : undef}" DIR
This should write a DateTimeOriginal of "1967:01:01 00:00:00" to your example file, and it will only update files with names that begin with 4 digits.
- Phil
:D :D :D :D :D
Thank you Thank you!!!!
Slight update for future me. Step 6 has been slightly updated. The correct procedure is this:
1. Scan photos
2. Name them like this: 1984-02 Birthday 001.tif, 1984-02 Birthday 002.tif, 1989-08 Vacation 001.tif, etc.
3. Place exiftool in Windows system directory (follow installation info)
4. Open Command prompt (in Windows 10)
5. Type the following: exiftool "-filecreatedate<${filename;s/ .*//} 01 00:00:00" c:/testphotos
6. Then after step 5 finishes, type the following: exiftool "-filecreatedate+<0:$filesequence" c:/testphotos
Quote from: thumperstrauss on June 10, 2018, 04:59:18 PM
For future me, here are the two steps that worked (thanks to Phil Harvey and Star Geek):
1. Scan photos
2. Name them like this: 1984-02 Birthday 001.tif, 1984-02 Birthday 002.tif, 1989-08 Vacation 001.tif, etc.
3. Place exiftool in Windows system directory (follow installation info)
4. Open Command prompt (in Windows 10)
5. Type the following: exiftool "-filecreatedate<${filename;s/ .*//} 01 00:00:00" c:/testphotos (where c:/testphotos is the location of the folder... folder with spaces seems more troublefree, but need to look into this...)
6. Type the following: exiftool "-datetimeoriginal+<0:$filesequence" c:/testphotos
This changes the creation date and forces Google photos to place the images in the correct order.
@PhilHarvey I'm having a weird problem. I'm using the following two commands, one at a time in order to se the filecreatedate to grab the date from the file name (2010-02 party 01.jpg). It works, but all my files from 1968 and 1969 (that's where my files begin) turn into 2068 and 2069. Everything from 1970 onwards resolves okay. Any idea what this could be? I just installed the latest exiftool (exiftool-11.31) and tried again, but same result.
exiftool "-filecreatedate<${filename;s/ .*//} 01 00:00:00" c:/testphotos
exiftool "-filecreatedate+<0:$filesequence" c:/testphotos
Previous threads on the subject:
Interesting results changing file system dates 1969 to 1968, and 1980 to 1979 (https://exiftool.org/forum/index.php?topic=9192.0)
Use of FileModifyDate not working in my batch job (https://exiftool.org/forum/index.php/topic,8848.msg45531.html)
Windows FileAccessDate, FileCreateDate, and FileModifyDate wrong century (https://exiftool.org/forum/index.php/topic,8704.msg44659.html#msg44659)
tl;dr,
ExifTool uses standard Perl date/time routines to do the necessary conversions. These routines are based on an epoch date of 1970, and the behaviour before that can be funny. Exiftool cannot properly set file system dates between 1900:01:01 00:00:00 and 1968:12:31 23:59:59.
StarGeek is correct.
And a FileCreateDate of before 1970 is not physical, and won't be supported by many filesystems anyway.
- Phil
Quote
exiftool "-alldates<$directory 00:00:00" -r DIR
Hi Phil,
I'm just starting with exiftool. I have photos with the following date formats and I would like to put those dates into the EXIF info. I don't care about times:
20170423_155550_resized.jpg
2017-02-04_20-46-15.jpg
20180506_xxxxxxxx_LowRes.jpg
IMG-20180302-WA0000.jpg
On the whole directory, I've tried:
exiftool "-alldates<$directory 00:00:00" -rand
exiftool "-alldates<$filename" ...both followed by the directory name, of course. For the first command, I get:
Warning: Invalid tag name '00:00:00' filename
and
Warning: No writable tags set from filename
For the second, I get:
Warning: No writable tags set from filename
Would you please help me get started on this?
Are you on a Mac? If so, use single quotes instead of double quotes.
- Phil
Thanks!
Is there a way that I can do it more dangerously--that does not leave the original files behind and tagged with ".original"?
You can add -overwrite_original to the command.
- Phil
Great. Thanks for all of the work you do and help you provide.