ExifTool Forum

ExifTool => The "exiftool" Application => Topic started by: Arni on February 21, 2014, 10:38:49 AM

Title: How to increment file creation date from file to file
Post by: Arni on February 21, 2014, 10:38:49 AM
Hello,

I'm from Germany and have many JPG files that doesn't contain any EXIF information.
For all of these files I want to assign a specific EXIF creation date/time
that is incremented by a specific amount (maybe 1 minute) from file to file,
using an alphabetical order by their file name (from "A" to "Z").

If there is any way, how can I do this using the command-line application "exiftool"?
(Operating system is Mac OS X 10.6.8 "Snow Leopard".)

I've already installed exiftool on my Mac Pro successfully and would be profoundly
grateful for any help and answer to the issue.


Arni
Title: Re: How to increment file creation date from file to file
Post by: Phil Harvey on February 21, 2014, 10:53:28 AM
Hi Arni,

This is a bit tricky, but you could do this with 2 commands:

1) First set all images to the same date/time:

exiftool -datetimeoriginal="2014:02:21 10:48:00" DIR

2) Increment the times by one additional minute for each file:

exiftool '-datetimeoriginal+<0:$filesequence' DIR

where DIR is a directory containing the images.  (You must use single quotes instead of double quotes around the argument in the second command since you are running on a Mac.) The +< syntax copies the value of other tags and uses it to increment the target tag, and the format for incrementing minutes is "0:MM".  Here, I have used the Extra (https://exiftool.org/TagNames/Extra.html) FileSequence tag to give me the incrementing values that we need.

On a Mac, the files will be processed in alphabetical order, so you don't need to worry about this.  (ie. specifying -fileorder FileName should not be necessary.)

- Phil
Title: Re: How to increment file creation date from file to file
Post by: Arni on February 21, 2014, 01:32:15 PM
Hi Phil,

I tested your code and it works great. (http://www.arni.bplaced.net/phpBB2/images/smiles/thumbs_up.gif)
Also, I modified your code a little bit so it works recursively for all file times, incrementing seconds instead of minutes.


exiftool -all= -AllDates="2000:01:01 00:00:01" /Users/Arni/Desktop/Test -i SYMLINKS -overwrite_original -r
exiftool '-AllDates+<0:0:$filesequence' /Users/Arni/Desktop/Test -i SYMLINKS -overwrite_original -r
find /Users/Arni/Desktop/Test -type f -exec touch -c -t 200001010000.00 {} +


The only thing remaining is, that exiftool creates new files under the current date in the inode of the file system.
I added a command using "find" and "touch" to change file access/modification/creation times to 2000/01/01 00:00:00.00.
I would rather like to change them to the individual EXIF times that I have created for each file but I don't know how I can do this.
Have you any idea?

Arni
Title: Re: How to increment file creation date from file to file
Post by: Phil Harvey on February 21, 2014, 01:35:30 PM
Hi Arni,

You have full control over the FileModifyDate after editing with exiftool.  Either use -P to preserve the original date/time, or set FileModifyDate to whatever else you want with an argument like -filemodifydate='2000:01:01 00:00:00' or '-filemodifydate<datetimeoriginal'.

- Phil
Title: Re: How to increment file creation date from file to file
Post by: Arni on February 21, 2014, 01:47:09 PM
Hi Phil,

I want the file creation/modify/access times of the file system's inode (HFS+) to be exactly the same value as the EXIF data for each file.
How can I do this?


Arni
Title: Re: How to increment file creation date from file to file
Post by: Phil Harvey on February 21, 2014, 01:49:04 PM
Hi Arni,

ExifTool can not set the file creation or access time, but as I said you can set the FileModifyDate to anything you want.

- Phil
Title: Re: How to increment file creation date from file to file
Post by: Arni on February 21, 2014, 02:33:04 PM
Quote from: Phil Harvey on February 21, 2014, 01:49:04 PM
ExifTool can not set the file creation or access time, but as I said you can set the FileModifyDate to anything you want.

OK Phil, I understand.

The "touch" command could do this modifications. I think I need
to find a way to increase the date/time of "touch" from file to file
in the same way I did for the "exiftool" command.


Many thanks for your help!

Arni
Title: Re: How to increment file creation date from file to file
Post by: Phil Harvey on February 21, 2014, 02:39:44 PM
I don't think that touch can set the file creation date either (tell me if I'm wrong about this), and setting the file access date is pretty-well useless (unless you're a hacker trying to cover your tracks), so I don't see the point in using touch.

The creation date can be set indirectly on the Mac.  See the FileCreateDate notes in the Extra tags documentation (https://exiftool.org/TagNames/Extra.html) for details.

- Phil
Title: Re: How to increment file creation date from file to file
Post by: Arni on February 21, 2014, 03:04:18 PM
The "touch" command is actually to change the file access and modification times.
But if the modification time is set to a time before the creation time of the file,
it forces to be set the creation time as well.

Another way is to use the Apple developer tools command "SetFile".
-> https://developer.apple.com/library/mac/documentation/Darwin/Reference/ManPages/man1/SetFile.1.html
-> http://hints.macworld.com/article.php?story=20011018172352562&query=creation+date

Arni
Title: Re: How to increment file creation date from file to file
Post by: Phil Harvey on February 21, 2014, 03:05:41 PM
Hi Arni,

Quote from: Arni on February 21, 2014, 03:04:18 PM
The "touch" command is actually to change the file access and modification times.
But if the modification time is set to a time before the creation time of the file,
it forces to be set the creation time as well.

Yes.  ExifTool does this too.  (As explained in documentation I linked in my last post.)

- Phil

Title: Re: How to increment file creation date from file to file
Post by: Arni on February 21, 2014, 05:16:15 PM
Hi Phil,

Finally, I've got it down pat. I have tested your code and it works fine. (http://www.arni.bplaced.net/phpBB2/images/smiles/thumbs_up.gif)
Here are the 3 commands that will do the job.


exiftool -all= -AllDates="2000:01:01 00:01:00" /Users/Arni/Desktop/Test -overwrite_original -r
exiftool '-AllDates+<0:$FileSequence' /Users/Arni/Desktop/Test -overwrite_original -r
exiftool '-FileModifyDate<DateTimeOriginal' /Users/Arni/Desktop/Test -r


Thanks a lot!


Arni
Title: Re: How to increment file creation date from file to file
Post by: NT4Boy on March 10, 2014, 04:46:02 PM
Hi,

This is exactly what I need to do on my Windows box, but I cannot get this syntax to work.
I've a few hundred files, some have been edited and the metadata overwritten and my IPAD needs the DateTimeOriginal or CreateDate data to show things in a consistent order. (I think)

exiftool -AllDates="2014:02:21 10:48:00" c:\11\exif\pics -overwrite_original -r
exiftool -AllDates+<0:$filesequence C:\11\exif\pics\ -fileOrder FileName -overwrite_original -r

first line is fine and does what I expect,
the second line fails with "the system cannot find the path specified."

Appreciate some guidance please.

Thanks
Title: Re: How to increment file creation date from file to file
Post by: StarGeek on March 10, 2014, 05:40:06 PM
Any time you use the '<' or '>' on windows, you need to put that part of the command in double quotes in order to avoid redirection.  If you check, you might have a file with AllDates in the filename in the directory you ran it from. 

Try this:
exiftool "-AllDates+<0:$filesequence" C:\11\exif\pics\ -fileOrder FileName -overwrite_original -r
Title: Re: How to increment file creation date from file to file
Post by: NT4Boy on March 11, 2014, 04:51:22 PM
Ah yes, that'll teach me to just cut and paste without reading and fully understanding.
You were of course correct, thank you.

Took quite a while to run through the 400 odd files, but now show in the required order. Excellent.

Hmm, I notice that in and amongst these jpg are a handful .mov files and I guess the Exif not able to deal with these in the same way.
Ipad originally filed them in sequence with the jpg and now all movies are all clustered together at the recent end of the folder.
More research I guess on how the Ipad decides when a movie was created and then how to put that in with the pictures...the tasks we get from our dearest and nearest's..!
Title: Re: How to increment file creation date from file to file
Post by: StarGeek on March 11, 2014, 05:26:32 PM
Quote from: NT4Boy on March 11, 2014, 04:51:22 PMHmm, I notice that in and amongst these jpg are a handful .mov files and I guess the Exif not able to deal with these in the same way.

From FAQ 16 (http://www.exiftool.org/faq.html#Q16)

QuoteBy default, ExifTool only processes writable file types when any tag is being written and a directory name is specified on the command line. To force exiftool to process other files, they must either be listed on the command line by name, or be specified using the -ext option, something like this:

exiftool -ext AVI -ext JPG -d pics/%Y/%m "-directory<dateTimeOriginal" DIR

When a single -ext option is used, only files of the specified type are processed. However, multiple -ext options may be used in the same command (as in the example above) to process any number of different file types.

If you know everything in the directory can be processed, you can use -ext * to have it process all the files.
Title: Re: How to increment file creation date from file to file
Post by: NT4Boy on March 12, 2014, 12:59:48 PM
Sir,

I think that by using the commands I did, which are pointing  at a directory, then I think you are saying all files ought to be processed if writable.
Looking at the .mov files, then the file date is actually the same as those jpgs updated by exiftool, and dropping the .mov files on exiftool(-k) I can see that to my surprise the DateTime Original and Create exist  in the series put in by my command, so I think now that they were processed.
Its just the IPAD, has other ideas about where they belong.

Ok, the answer is that to get the .MOV files to correctly mix in with the the jpegs, I read the date and time of day of the AllDates meta in the jpeg numerically nearest the .mov and then wrote the appropiate date and time stamps on the file using a Windows version of 'touch'.
filetouch /W /A /C /D 02-21-2014 /T 12:09:00 G:\DCIM\101DICAM\DSCN1227.mov
Thanks all
One important thing being to write to the SD card direct that will be used by the IPAD for import as if you copy a file onto the SD card after 'touching' it, the relevant date changes again...
Title: Re: How to increment file creation date from file to file
Post by: classicbs on November 09, 2015, 07:42:22 AM
Hi there, replying here as I don't want people to reply saying "search the forums"  Should I start a new topic??

I've been trying to do this on a mac using the following commands as explained here: http://photo.stackexchange.com/questions/60342/how-can-i-incrementally-date-photos

exiftool -datetimeoriginal="2015:02:22 00:00:00" DIR
And then increment the time on each

exiftool '-datetimeoriginal+<0:0:${filesequence}0' DIR

it seems to have worked on my selection of 318 photos.  But for some reason the first 33 photos are just all over the place (in terms of the time of day they were taken) then from 33 onwards they go up in 1 minute increments as expected.  The first 33 are a s follows

1- 12:00 PM  (as I changed them all to)
2- 13.51
3- 15.42
4- 16.12
5- 16.34
6- 16.45
7- 16.56

blah blah blah

31- 15.54
32- 16.04
33- 16.05
34- 16.06
35- 16.07 etc etc

Can anyone work out whats going on with my set up?  Please use layman terms as I'm not a programmer and don't understand much of this.  There seems to be no pattern

Many thanks,

James

Title: Re: How to increment file creation date from file to file
Post by: Phil Harvey on November 09, 2015, 08:33:46 AM
Hi James,

Adding to this topic is fine.

I tried your command and it adjusted the DateTimeOriginal values by increments of 10 seconds as expected.

I don't understand the times you list because you don't show the seconds and I expect increments of 10 seconds.  So I assume the command you ran is not the one you posted.  Also, are you sure that the command processed all of the files you listed?  Alternatively, could there be other files not listed that the command also processed?  (Perhaps you used -r and aren't looking at the subdirectories that were processed?)  Either case could cause the observed problem.

- Phil
Title: Re: How to increment file creation date from file to file
Post by: classicbs on November 09, 2015, 10:03:14 AM
Thanks Phil,

These are the two commands I used:

exiftool -datetimeoriginal="2004:09:01 12:00:00" /Users/jamesbayliss-smith/Desktop/Nepal\ Tibet\ 2004\ NEW

exiftool '-datetimeoriginal+<0:$filesequence' /Users/jamesbayliss-smith/Desktop/Nepal\ Tibet\ 2004\ NEW

And here is what it says in Terminal

Last login: Mon Nov  9 12:21:28 on ttys004
Jamess-MacBook-Pro:~ jamesbayliss-smith$ exiftool -datetimeoriginal="2004:09:01 12:00:00" /Users/jamesbayliss-smith/Desktop/Nepal\ Tibet\ 2004\ NEW
    1 directories scanned
  318 image files updated
Jamess-MacBook-Pro:~ jamesbayliss-smith$ exiftool '-datetimeoriginal+<0:$filesequence' /Users/jamesbayliss-smith/Desktop/Nepal\ Tibet\ 2004\ NEW
    1 directories scanned
  317 image files updated
    1 image files unchanged
Jamess-MacBook-Pro:~ jamesbayliss-smith$

QuoteAdding to this topic is fine.

Cool I wasn't sure if it was still being monitored

QuoteI tried your command and it adjusted the DateTimeOriginal values by increments of 10 seconds as expected.

I just tried running it again and I got the same result.  I actually described it innacuratly above.  They adjusted them by 1 minute each time exept for the first 33 Photos.  Strange?  Where in the formula does it specify the length each one is adjusted by?

QuoteI don't understand the times you list because you don't show the seconds and I expect increments of 10 seconds.

It did 1 minute increments (except first 33) all the seconds values on the whole job were 00

QuoteAlso, are you sure that the command processed all of the files you listed?  Alternatively, could there be other files not listed that the command also processed?  (Perhaps you used -r and aren't looking at the subdirectories that were processed?)  Either case could cause the observed problem.

It did prices them all then created new files.  I deleted the originals (I have them elsewhere) and checked the EXIFdat using the info box in the preview app (mac)

I'm stumped.  Let me know if you need more information and I'll try post it./  Thanks
Title: Re: How to increment file creation date from file to file
Post by: Phil Harvey on November 09, 2015, 01:15:01 PM
I suggest trying this:

exiftool -p '0:$filesequence' /Users/jamesbayliss-smith/Desktop/Nepal\ Tibet\ 2004\ NEW

And post the output here.

- Phil
Title: Re: How to increment file creation date from file to file
Post by: classicbs on November 09, 2015, 04:55:47 PM
Hi Phil, is this what you mean?

Jamess-MacBook-Pro:~ jamesbayliss-smith$ exiftool -p '0:$filesequence' /Users/jamesbayliss-smith/Desktop/Nepal\ Tibet\ 2004\ NEW
0:0
0:1
0:2
0:3
0:4
0:5
0:6
0:7
0:8
0:9
0:10
0:11
0:12
0:13
0:14
0:15
0:16
0:17
0:18
0:19
0:20
0:21
0:22
0:23
0:24
0:25
0:26
0:27
0:28
0:29
0:30
0:31
0:32
0:33
0:34
0:35
0:36
0:37
0:38
0:39
0:40
0:41
0:42
0:43
0:44
0:45
0:46
0:47
0:48
0:49
0:50
0:51
0:52
0:53
0:54
0:55
0:56
0:57
0:58
0:59
0:60
0:61
0:62
0:63
0:64
0:65
0:66
0:67
0:68
0:69
0:70
0:71
0:72
0:73
0:74
0:75
0:76
0:77
0:78
0:79
0:80
0:81
0:82
0:83
0:84
0:85
0:86
0:87
0:88
0:89
0:90
0:91
0:92
0:93
0:94
0:95
0:96
0:97
0:98
0:99
0:100
0:101
0:102
0:103
0:104
0:105
0:106
0:107
0:108
0:109
0:110
0:111
0:112
0:113
0:114
0:115
0:116
0:117
0:118
0:119
0:120
0:121
0:122
0:123
0:124
0:125
0:126
0:127
0:128
0:129
0:130
0:131
0:132
0:133
0:134
0:135
0:136
0:137
0:138
0:139
0:140
0:141
0:142
0:143
0:144
0:145
0:146
0:147
0:148
0:149
0:150
0:151
0:152
0:153
0:154
0:155
0:156
0:157
0:158
0:159
0:160
0:161
0:162
0:163
0:164
0:165
0:166
0:167
0:168
0:169
0:170
0:171
0:172
0:173
0:174
0:175
0:176
0:177
0:178
0:179
0:180
0:181
0:182
0:183
0:184
0:185
0:186
0:187
0:188
0:189
0:190
0:191
0:192
0:193
0:194
0:195
0:196
0:197
0:198
0:199
0:200
0:201
0:202
0:203
0:204
0:205
0:206
0:207
0:208
0:209
0:210
0:211
0:212
0:213
0:214
0:215
0:216
0:217
0:218
0:219
0:220
0:221
0:222
0:223
0:224
0:225
0:226
0:227
0:228
0:229
0:230
0:231
0:232
0:233
0:234
0:235
0:236
0:237
0:238
0:239
0:240
0:241
0:242
0:243
0:244
0:245
0:246
0:247
0:248
0:249
0:250
0:251
0:252
0:253
0:254
0:255
0:256
0:257
0:258
0:259
0:260
0:261
0:262
0:263
0:264
0:265
0:266
0:267
0:268
0:269
0:270
0:271
0:272
0:273
0:274
0:275
0:276
0:277
0:278
0:279
0:280
0:281
0:282
0:283
0:284
0:285
0:286
0:287
0:288
0:289
0:290
0:291
0:292
0:293
0:294
0:295
0:296
0:297
0:298
0:299
0:300
0:301
0:302
0:303
0:304
0:305
0:306
0:307
0:308
0:309
0:310
0:311
0:312
0:313
0:314
0:315
0:316
0:317
    1 directories scanned
  318 image files read
Jamess-MacBook-Pro:~ jamesbayliss-smith$


PH Edit: Formatted output as a code block
Title: Re: How to increment file creation date from file to file
Post by: Phil Harvey on November 10, 2015, 07:33:17 AM
Hi James,

Yes, that's what I meant.  These are the time shift values you are applying.  I should have used -p '0:$filesequence $filename' to see what files they are being applied to, but it looks like the shifts are correct.

Using this output you should be able to reproduce the processing steps for a single file and figure out what is happening.  Again, when I try this on my system here the dates are shifted as expected, so this is a bit of a mystery that you will have to investigate at your end.

- Phil
Title: Re: How to increment file creation date from file to file
Post by: classicbs on November 10, 2015, 07:50:09 AM
Okay thanks it's to do with the way the files are numbered I need to start with 001.  Thanks for you help

Jamess-MacBook-Pro:~ jamesbayliss-smith$ exiftool -p '0:$filesequence $filename' /Users/jamesbayliss-smith/Desktop/Nepal\ Tibet\ 2004\ NEW
0:0 Nepal-Tibet-2004 - 1.jpg
0:1 Nepal-Tibet-2004 - 10.jpg
0:2 Nepal-Tibet-2004 - 100.jpg
0:3 Nepal-Tibet-2004 - 101.jpg
0:4 Nepal-Tibet-2004 - 102.jpg
0:5 Nepal-Tibet-2004 - 103.jpg
0:6 Nepal-Tibet-2004 - 104.jpg
0:7 Nepal-Tibet-2004 - 105.jpg
0:8 Nepal-Tibet-2004 - 106.jpg
0:9 Nepal-Tibet-2004 - 107.jpg
0:10 Nepal-Tibet-2004 - 108.jpg
0:11 Nepal-Tibet-2004 - 109.jpg
0:12 Nepal-Tibet-2004 - 11.jpg
0:13 Nepal-Tibet-2004 - 110.jpg
0:14 Nepal-Tibet-2004 - 111.jpg
0:15 Nepal-Tibet-2004 - 112.jpg
0:16 Nepal-Tibet-2004 - 113.jpg
0:17 Nepal-Tibet-2004 - 114.jpg
0:18 Nepal-Tibet-2004 - 115.jpg
0:19 Nepal-Tibet-2004 - 116.jpg
0:20 Nepal-Tibet-2004 - 117.jpg
0:21 Nepal-Tibet-2004 - 118.jpg
0:22 Nepal-Tibet-2004 - 119.jpg
0:23 Nepal-Tibet-2004 - 12.jpg
0:24 Nepal-Tibet-2004 - 120.jpg
0:25 Nepal-Tibet-2004 - 121.jpg
0:26 Nepal-Tibet-2004 - 122.jpg
0:27 Nepal-Tibet-2004 - 123.jpg
0:28 Nepal-Tibet-2004 - 124.jpg
0:29 Nepal-Tibet-2004 - 125.jpg
0:30 Nepal-Tibet-2004 - 126.jpg
0:31 Nepal-Tibet-2004 - 127.jpg
0:32 Nepal-Tibet-2004 - 128.jpg
0:33 Nepal-Tibet-2004 - 129.jpg
0:34 Nepal-Tibet-2004 - 13.jpg
0:35 Nepal-Tibet-2004 - 130.jpg
0:36 Nepal-Tibet-2004 - 131.jpg
0:37 Nepal-Tibet-2004 - 132.jpg
0:38 Nepal-Tibet-2004 - 133.jpg
0:39 Nepal-Tibet-2004 - 134.jpg
0:40 Nepal-Tibet-2004 - 135.jpg
0:41 Nepal-Tibet-2004 - 136.jpg
0:42 Nepal-Tibet-2004 - 137.jpg
0:43 Nepal-Tibet-2004 - 138.jpg
0:44 Nepal-Tibet-2004 - 139.jpg
0:45 Nepal-Tibet-2004 - 14.jpg
0:46 Nepal-Tibet-2004 - 140.jpg
0:47 Nepal-Tibet-2004 - 141.jpg
0:48 Nepal-Tibet-2004 - 142.jpg
0:49 Nepal-Tibet-2004 - 143.jpg
0:50 Nepal-Tibet-2004 - 144.jpg
0:51 Nepal-Tibet-2004 - 145.jpg
0:52 Nepal-Tibet-2004 - 146.jpg
0:53 Nepal-Tibet-2004 - 147.jpg
0:54 Nepal-Tibet-2004 - 148.jpg
0:55 Nepal-Tibet-2004 - 149.jpg
0:56 Nepal-Tibet-2004 - 15.jpg
0:57 Nepal-Tibet-2004 - 150.jpg
0:58 Nepal-Tibet-2004 - 151.jpg
0:59 Nepal-Tibet-2004 - 152.jpg
0:60 Nepal-Tibet-2004 - 153.jpg
0:61 Nepal-Tibet-2004 - 154.jpg
0:62 Nepal-Tibet-2004 - 155.jpg
0:63 Nepal-Tibet-2004 - 156.jpg
0:64 Nepal-Tibet-2004 - 157.jpg
0:65 Nepal-Tibet-2004 - 158.jpg
0:66 Nepal-Tibet-2004 - 159.jpg
0:67 Nepal-Tibet-2004 - 16.jpg
0:68 Nepal-Tibet-2004 - 160.jpg
0:69 Nepal-Tibet-2004 - 161.jpg
0:70 Nepal-Tibet-2004 - 162.jpg
0:71 Nepal-Tibet-2004 - 163.jpg
0:72 Nepal-Tibet-2004 - 164.jpg
0:73 Nepal-Tibet-2004 - 165.jpg
0:74 Nepal-Tibet-2004 - 166.jpg
0:75 Nepal-Tibet-2004 - 167.jpg
0:76 Nepal-Tibet-2004 - 168.jpg
0:77 Nepal-Tibet-2004 - 169.jpg
0:78 Nepal-Tibet-2004 - 17.jpg
0:79 Nepal-Tibet-2004 - 170.jpg
0:80 Nepal-Tibet-2004 - 171.jpg
0:81 Nepal-Tibet-2004 - 172.jpg
0:82 Nepal-Tibet-2004 - 173.jpg
0:83 Nepal-Tibet-2004 - 174.jpg
0:84 Nepal-Tibet-2004 - 175.jpg
0:85 Nepal-Tibet-2004 - 176.jpg
0:86 Nepal-Tibet-2004 - 177.jpg
0:87 Nepal-Tibet-2004 - 178.jpg
0:88 Nepal-Tibet-2004 - 179.jpg
0:89 Nepal-Tibet-2004 - 18.jpg
0:90 Nepal-Tibet-2004 - 180.jpg
0:91 Nepal-Tibet-2004 - 181.jpg
0:92 Nepal-Tibet-2004 - 182.jpg
0:93 Nepal-Tibet-2004 - 183.jpg
0:94 Nepal-Tibet-2004 - 184.jpg
0:95 Nepal-Tibet-2004 - 185.jpg
0:96 Nepal-Tibet-2004 - 186.jpg
0:97 Nepal-Tibet-2004 - 187.jpg
0:98 Nepal-Tibet-2004 - 188.jpg
0:99 Nepal-Tibet-2004 - 189.jpg
0:100 Nepal-Tibet-2004 - 19.jpg
0:101 Nepal-Tibet-2004 - 190.jpg
0:102 Nepal-Tibet-2004 - 191.jpg
0:103 Nepal-Tibet-2004 - 192.jpg
0:104 Nepal-Tibet-2004 - 193.jpg
0:105 Nepal-Tibet-2004 - 194.jpg
0:106 Nepal-Tibet-2004 - 195.jpg
0:107 Nepal-Tibet-2004 - 196.jpg
0:108 Nepal-Tibet-2004 - 197.jpg
0:109 Nepal-Tibet-2004 - 198.jpg
0:110 Nepal-Tibet-2004 - 199.jpg
0:111 Nepal-Tibet-2004 - 2.jpg
0:112 Nepal-Tibet-2004 - 20.jpg
0:113 Nepal-Tibet-2004 - 200.jpg
0:114 Nepal-Tibet-2004 - 201.jpg
0:115 Nepal-Tibet-2004 - 202.jpg
0:116 Nepal-Tibet-2004 - 203.jpg
0:117 Nepal-Tibet-2004 - 204.jpg
0:118 Nepal-Tibet-2004 - 205.jpg
0:119 Nepal-Tibet-2004 - 206.jpg
0:120 Nepal-Tibet-2004 - 207.jpg
0:121 Nepal-Tibet-2004 - 208.jpg
0:122 Nepal-Tibet-2004 - 209.jpg
0:123 Nepal-Tibet-2004 - 21.jpg
0:124 Nepal-Tibet-2004 - 210.jpg
0:125 Nepal-Tibet-2004 - 211.jpg
0:126 Nepal-Tibet-2004 - 212.jpg
0:127 Nepal-Tibet-2004 - 213.jpg
0:128 Nepal-Tibet-2004 - 214.jpg
0:129 Nepal-Tibet-2004 - 215.jpg
0:130 Nepal-Tibet-2004 - 216.jpg
0:131 Nepal-Tibet-2004 - 217.jpg
0:132 Nepal-Tibet-2004 - 218.jpg
0:133 Nepal-Tibet-2004 - 219.jpg
0:134 Nepal-Tibet-2004 - 22.jpg
0:135 Nepal-Tibet-2004 - 220.jpg
0:136 Nepal-Tibet-2004 - 221.jpg
0:137 Nepal-Tibet-2004 - 222.jpg
0:138 Nepal-Tibet-2004 - 223.jpg
0:139 Nepal-Tibet-2004 - 224.jpg
0:140 Nepal-Tibet-2004 - 225.jpg
0:141 Nepal-Tibet-2004 - 226.jpg
0:142 Nepal-Tibet-2004 - 227.jpg
0:143 Nepal-Tibet-2004 - 228.jpg
0:144 Nepal-Tibet-2004 - 229.jpg
0:145 Nepal-Tibet-2004 - 23.jpg
0:146 Nepal-Tibet-2004 - 230.jpg
0:147 Nepal-Tibet-2004 - 231.jpg
0:148 Nepal-Tibet-2004 - 232.jpg
0:149 Nepal-Tibet-2004 - 233.jpg
0:150 Nepal-Tibet-2004 - 234.jpg
0:151 Nepal-Tibet-2004 - 235.jpg
0:152 Nepal-Tibet-2004 - 236.jpg
0:153 Nepal-Tibet-2004 - 237.jpg
0:154 Nepal-Tibet-2004 - 238.jpg
0:155 Nepal-Tibet-2004 - 239.jpg
0:156 Nepal-Tibet-2004 - 24.jpg
0:157 Nepal-Tibet-2004 - 240.jpg
0:158 Nepal-Tibet-2004 - 241.jpg
0:159 Nepal-Tibet-2004 - 242.jpg
0:160 Nepal-Tibet-2004 - 243.jpg
0:161 Nepal-Tibet-2004 - 244.jpg
0:162 Nepal-Tibet-2004 - 245.jpg
0:163 Nepal-Tibet-2004 - 246.jpg
0:164 Nepal-Tibet-2004 - 247.jpg
0:165 Nepal-Tibet-2004 - 248.jpg
0:166 Nepal-Tibet-2004 - 249.jpg
0:167 Nepal-Tibet-2004 - 25.jpg
0:168 Nepal-Tibet-2004 - 250.jpg
0:169 Nepal-Tibet-2004 - 251.jpg
0:170 Nepal-Tibet-2004 - 252.jpg
0:171 Nepal-Tibet-2004 - 253.jpg
0:172 Nepal-Tibet-2004 - 254.jpg
0:173 Nepal-Tibet-2004 - 255.jpg
0:174 Nepal-Tibet-2004 - 256.jpg
0:175 Nepal-Tibet-2004 - 257.jpg
0:176 Nepal-Tibet-2004 - 258.jpg
0:177 Nepal-Tibet-2004 - 259.jpg
0:178 Nepal-Tibet-2004 - 26.jpg
0:179 Nepal-Tibet-2004 - 260.jpg
0:180 Nepal-Tibet-2004 - 261.jpg
0:181 Nepal-Tibet-2004 - 262.jpg
0:182 Nepal-Tibet-2004 - 263.jpg
0:183 Nepal-Tibet-2004 - 264.jpg
0:184 Nepal-Tibet-2004 - 265.jpg
0:185 Nepal-Tibet-2004 - 266.jpg
0:186 Nepal-Tibet-2004 - 267.jpg
0:187 Nepal-Tibet-2004 - 268.jpg
0:188 Nepal-Tibet-2004 - 269.jpg
0:189 Nepal-Tibet-2004 - 27.jpg
0:190 Nepal-Tibet-2004 - 270.jpg
0:191 Nepal-Tibet-2004 - 271.jpg
0:192 Nepal-Tibet-2004 - 272.jpg
0:193 Nepal-Tibet-2004 - 273.jpg
0:194 Nepal-Tibet-2004 - 274.jpg
0:195 Nepal-Tibet-2004 - 275.jpg
0:196 Nepal-Tibet-2004 - 276.jpg
0:197 Nepal-Tibet-2004 - 277.jpg
0:198 Nepal-Tibet-2004 - 278.jpg
0:199 Nepal-Tibet-2004 - 279.jpg
0:200 Nepal-Tibet-2004 - 28.jpg
0:201 Nepal-Tibet-2004 - 280.jpg
0:202 Nepal-Tibet-2004 - 281.jpg
0:203 Nepal-Tibet-2004 - 282.jpg
0:204 Nepal-Tibet-2004 - 283.jpg
0:205 Nepal-Tibet-2004 - 284.jpg
0:206 Nepal-Tibet-2004 - 285.jpg
0:207 Nepal-Tibet-2004 - 286.jpg
0:208 Nepal-Tibet-2004 - 287.jpg
0:209 Nepal-Tibet-2004 - 288.jpg
0:210 Nepal-Tibet-2004 - 289.jpg
0:211 Nepal-Tibet-2004 - 29.jpg
0:212 Nepal-Tibet-2004 - 290.jpg
0:213 Nepal-Tibet-2004 - 291.jpg
0:214 Nepal-Tibet-2004 - 292.jpg
0:215 Nepal-Tibet-2004 - 293.jpg
0:216 Nepal-Tibet-2004 - 294.jpg
0:217 Nepal-Tibet-2004 - 295.jpg
0:218 Nepal-Tibet-2004 - 296.jpg
0:219 Nepal-Tibet-2004 - 297.jpg
0:220 Nepal-Tibet-2004 - 298.jpg
0:221 Nepal-Tibet-2004 - 299.jpg
0:222 Nepal-Tibet-2004 - 3.jpg
0:223 Nepal-Tibet-2004 - 30.jpg
0:224 Nepal-Tibet-2004 - 300.jpg
0:225 Nepal-Tibet-2004 - 301.jpg
0:226 Nepal-Tibet-2004 - 302.jpg
0:227 Nepal-Tibet-2004 - 303.jpg
0:228 Nepal-Tibet-2004 - 304.jpg
0:229 Nepal-Tibet-2004 - 305.jpg
0:230 Nepal-Tibet-2004 - 306.jpg
0:231 Nepal-Tibet-2004 - 307.jpg
0:232 Nepal-Tibet-2004 - 308.jpg
0:233 Nepal-Tibet-2004 - 309.jpg
0:234 Nepal-Tibet-2004 - 31.jpg
0:235 Nepal-Tibet-2004 - 310.jpg
0:236 Nepal-Tibet-2004 - 311.jpg
0:237 Nepal-Tibet-2004 - 312.jpg
0:238 Nepal-Tibet-2004 - 313.jpg
0:239 Nepal-Tibet-2004 - 314.jpg
0:240 Nepal-Tibet-2004 - 315.jpg
0:241 Nepal-Tibet-2004 - 316.jpg
0:242 Nepal-Tibet-2004 - 317.jpg
0:243 Nepal-Tibet-2004 - 318.jpg
0:244 Nepal-Tibet-2004 - 32.jpg
0:245 Nepal-Tibet-2004 - 33.jpg
0:246 Nepal-Tibet-2004 - 34.jpg
0:247 Nepal-Tibet-2004 - 35.jpg
0:248 Nepal-Tibet-2004 - 36.jpg
0:249 Nepal-Tibet-2004 - 37.jpg
0:250 Nepal-Tibet-2004 - 38.jpg
0:251 Nepal-Tibet-2004 - 39.jpg
0:252 Nepal-Tibet-2004 - 4.jpg
0:253 Nepal-Tibet-2004 - 40.jpg
0:254 Nepal-Tibet-2004 - 41.jpg
0:255 Nepal-Tibet-2004 - 42.jpg
0:256 Nepal-Tibet-2004 - 43.jpg
0:257 Nepal-Tibet-2004 - 44.jpg
0:258 Nepal-Tibet-2004 - 45.jpg
0:259 Nepal-Tibet-2004 - 46.jpg
0:260 Nepal-Tibet-2004 - 47.jpg
0:261 Nepal-Tibet-2004 - 48.jpg
0:262 Nepal-Tibet-2004 - 49.jpg
0:263 Nepal-Tibet-2004 - 5.jpg
0:264 Nepal-Tibet-2004 - 50.jpg
0:265 Nepal-Tibet-2004 - 51.jpg
0:266 Nepal-Tibet-2004 - 52.jpg
0:267 Nepal-Tibet-2004 - 53.jpg
0:268 Nepal-Tibet-2004 - 54.jpg
0:269 Nepal-Tibet-2004 - 55.jpg
0:270 Nepal-Tibet-2004 - 56.jpg
0:271 Nepal-Tibet-2004 - 57.jpg
0:272 Nepal-Tibet-2004 - 58.jpg
0:273 Nepal-Tibet-2004 - 59.jpg
0:274 Nepal-Tibet-2004 - 6.jpg
0:275 Nepal-Tibet-2004 - 60.jpg
0:276 Nepal-Tibet-2004 - 61.jpg
0:277 Nepal-Tibet-2004 - 62.jpg
0:278 Nepal-Tibet-2004 - 63.jpg
0:279 Nepal-Tibet-2004 - 64.jpg
0:280 Nepal-Tibet-2004 - 65.jpg
0:281 Nepal-Tibet-2004 - 66.jpg
0:282 Nepal-Tibet-2004 - 67.jpg
0:283 Nepal-Tibet-2004 - 68.jpg
0:284 Nepal-Tibet-2004 - 69.jpg
0:285 Nepal-Tibet-2004 - 7.jpg
0:286 Nepal-Tibet-2004 - 70.jpg
0:287 Nepal-Tibet-2004 - 71.jpg
0:288 Nepal-Tibet-2004 - 72.jpg
0:289 Nepal-Tibet-2004 - 73.jpg
0:290 Nepal-Tibet-2004 - 74.jpg
0:291 Nepal-Tibet-2004 - 75.jpg
0:292 Nepal-Tibet-2004 - 76.jpg
0:293 Nepal-Tibet-2004 - 77.jpg
0:294 Nepal-Tibet-2004 - 78.jpg
0:295 Nepal-Tibet-2004 - 79.jpg
0:296 Nepal-Tibet-2004 - 8.jpg
0:297 Nepal-Tibet-2004 - 80.jpg
0:298 Nepal-Tibet-2004 - 81.jpg
0:299 Nepal-Tibet-2004 - 82.jpg
0:300 Nepal-Tibet-2004 - 83.jpg
0:301 Nepal-Tibet-2004 - 84.jpg
0:302 Nepal-Tibet-2004 - 85.jpg
0:303 Nepal-Tibet-2004 - 86.jpg
0:304 Nepal-Tibet-2004 - 87.jpg
0:305 Nepal-Tibet-2004 - 88.jpg
0:306 Nepal-Tibet-2004 - 89.jpg
0:307 Nepal-Tibet-2004 - 9.jpg
0:308 Nepal-Tibet-2004 - 90.jpg
0:309 Nepal-Tibet-2004 - 91.jpg
0:310 Nepal-Tibet-2004 - 92.jpg
0:311 Nepal-Tibet-2004 - 93.jpg
0:312 Nepal-Tibet-2004 - 94.jpg
0:313 Nepal-Tibet-2004 - 95.jpg
0:314 Nepal-Tibet-2004 - 96.jpg
0:315 Nepal-Tibet-2004 - 97.jpg
0:316 Nepal-Tibet-2004 - 98.jpg
0:317 Nepal-Tibet-2004 - 99.jpg
    1 directories scanned
  318 image files read
Jamess-MacBook-Pro:~ jamesbayliss-smith$


PH Edit: Formatted output as a code block
Title: Re: How to increment file creation date from file to file
Post by: Phil Harvey on November 10, 2015, 07:56:20 AM
Mystery solved! :)
Title: Re: How to increment file creation date from file to file
Post by: fdewulf on December 05, 2015, 05:59:09 PM
Thank you Phil and classicbs for all this.   

This solves a huge problem for Mac users with the Photos App: 

Apple has chosen to only allow one form of sorting in the shared iCloud folders: creation date, most recent first.  (It seems)

I have over 80,000 photos neatly organized in catalogs with numerical name to sort them in the right order.
So now I need to be able to go wrap the Exif command above using an Automator App, Service or maybe even folder action?
So I can drop ANY folder with file in it and have it process the files and redate them without having to type the code in Terminal

What is the best way to do this?
Title: Re: How to increment file creation date from file to file
Post by: fdewulf on December 05, 2015, 08:01:27 PM
OK I tested the setting up as a service with Automator and now I can right click on a folder and select my service that includes a 'RunShell Script' command that automatically uses the name fo the folder I right clicked and changes all the dated incrementally as you guys discussed above .   The only thing left is for me to figure out how to pass a user inputed date.
Title: Re: How to increment file creation date from file to file
Post by: Hayo Baan on December 06, 2015, 04:15:47 AM
I haven't found a simple (I.e., one that doesn't require additional software/programming) way to get user input from within an Automator script (one would assume there was, but alas it doesn't seem so). A suggestion I can make Is to store the date in a file and have the script read that file. That way you can easily change the date and run the service as before.
Title: Re: How to increment file creation date from file to file
Post by: StarGeek on December 06, 2015, 01:29:02 PM
Can an Automator script read the clipboard?  If so, you could copy the date to the clipboard before running the script. 
Title: Re: How to increment file creation date from file to file
Post by: makapav on May 16, 2017, 05:54:54 PM
Thank-you everyone for your help and examples. I parsed through the information here to get the combinations I needed.
Title: Re: How to increment file creation date from file to file
Post by: halfasia on September 06, 2017, 01:32:43 AM
I have tried using the above commands and receive the message "No file specified"

Andrews-Air:~ Andy$ exiftool '-datetimeoriginal+<0:$filesequence'/Users/Andy/Desktop/wedding/1
No file specified

Suggestions?
Title: Re: How to increment file creation date from file to file
Post by: StarGeek on September 06, 2017, 03:31:38 AM
There should be a space after the quote and before the slash that is the start of the file path.

Title: Re: How to increment file creation date from file to file
Post by: Stephen Marsh on September 06, 2017, 04:20:09 AM
EDIT: Ah, I did not see StarGeeks reply!

exiftool '-datetimeoriginal+<0:$filesequence'/Users/Andy/Desktop/wedding/1

Add a space before the directory path:

exiftool '-datetimeoriginal+<0:$filesequence' /Users/Andy/Desktop/wedding/1

If this is on a Mac and you did not drag the folder into Terminal.app you may also wish to enclose the directory path in single quotes too. This is not necessary in this case as there are no word spaces in the path, it is just good habit for paths that do not contain escaped word spaces:

'/Users/Andy/Desktop/wedding/1'

P.S. I am presuming that "1" is a folder?
Title: Re: How to increment file creation date from file to file
Post by: StarGeek on September 06, 2017, 08:51:45 AM
Quote from: Stephen Marsh on September 06, 2017, 04:20:09 AM
EDIT: Ah, I did not see StarGeeks reply!

But you had a more complete answer than my lazy one :)
Title: Re: How to increment file creation date from file to file
Post by: halfasia on September 06, 2017, 09:02:23 PM
Yeah adding the space fixed it. Thanks!
Title: Re: How to increment file creation date from file to file
Post by: heatvent on August 12, 2018, 08:47:14 PM
Hi, I modified the above code for a similar use.  I have scanned slide jpg files sorted as follows P:\Processed\YEAR\Subject.  I use the following batch file to change the date taken the 1/1/YEAR 11:01 am and then increment each file by 1 minute.  This is mostly to get the files to show in the correct year for photo apps and to keep in sequence.  I have no idea of the actual date taken:)

Command to use (1963 as an example year):

ExifToolReDate.bat 1963

ExifToolReDate.bat Batch file code....


echo off

set YEAR=%1

echo Working on all files in P:\Processed\%YEAR%

echo Changing year for all dates in files...

exiftool -all= -AllDates="%YEAR%:01:01 11:01:00" -recurse -quiet -overwrite_original P:\Processed\%YEAR%

echo Incrementing all times by 1 minute...

exiftool "-AllDates+<0:${filesequence}" -recurse -quiet -overwrite_original P:\Processed\%YEAR%

echo Process completed!
Title: Re: How to increment file creation date from file to file
Post by: suplemereader on January 20, 2019, 03:58:41 AM
Hello. exiftool is amazingly feature-rich, but i'm lost. Resurrecting the thread but looking for guidance.

I want to increment SubSecTimeOriginal to get a trailing digit on timestamps, as in DateTimeOriginal shown below.

$ exiftool -Time:All /Users/jrb8/Desktop/sortphotos_test/img___00001.jpg
File Modification Date/Time     : 2019:01:20 03:00:51-05:00
File Access Date/Time           : 2019:01:20 03:13:57-05:00
File Inode Change Date/Time     : 2019:01:20 03:00:51-05:00
Modify Date                     : 2000:09:13 20:20:03
Date/Time Original              : 2014:02:21 10:48:00
Create Date                     : 2000:09:13 11:40:49
Sub Sec Time Original           : 0
Date Created                    : 2000:09:13
Time Created                    : 11:40:49-05:00
Date/Time Created               : 2000:09:13 11:40:49-05:00
Date/Time Original              : 2014:02:21 10:48:00.0


I'm able to set an initial SubSecTimeOriginal value for every file in the directory...
$ exiftool -subsectimeoriginal="0" /Users/jrb8/Desktop/sortphotos_test/ -overwrite_original_in_place
1 directories scanned
10 image files updated


and a test run of the incrementing appears successful...
$ exiftool -p '0:$filesequence $filename' /Users/jrb8/Desktop/sortphotos_test/
0:0 img___00001.jpg
0:1 img___00002.jpg
0:2 img___00003.jpg
0:3 img___00007.jpg
0:4 img___00006.jpg
0:5 img___00004.jpg
0:6 img___00010.jpg
0:7 img___00005.jpg
0:8 img___00008.jpg
0:9 img___00009.jpg


But I cannot get the final piece of it to run successfully...  $ exiftool '-subsectimeoriginal+<0:$filesequence' /Users/jrb8/Desktop/sortphotos_test/ -overwrite_original_in_place
Warning: No writable tags set from /Users/jrb8/Desktop/sortphotos_test/img___00001.jpg
Warning: No writable tags set from /Users/jrb8/Desktop/sortphotos_test/img___00002.jpg
Warning: No writable tags set from /Users/jrb8/Desktop/sortphotos_test/img___00003.jpg
Warning: No writable tags set from /Users/jrb8/Desktop/sortphotos_test/img___00007.jpg
Warning: No writable tags set from /Users/jrb8/Desktop/sortphotos_test/img___00006.jpg
Warning: No writable tags set from /Users/jrb8/Desktop/sortphotos_test/img___00004.jpg
Warning: No writable tags set from /Users/jrb8/Desktop/sortphotos_test/img___00010.jpg
Warning: No writable tags set from /Users/jrb8/Desktop/sortphotos_test/img___00005.jpg
Warning: No writable tags set from /Users/jrb8/Desktop/sortphotos_test/img___00008.jpg
Warning: No writable tags set from /Users/jrb8/Desktop/sortphotos_test/img___00009.jpg
    1 directories scanned
    0 image files updated
   10 image files unchanged



Any help is greatly appreciated.
Title: Re: How to increment file creation date from file to file
Post by: Phil Harvey on January 20, 2019, 08:02:56 AM
SubSecTimeOriginal is a single number, not a date/time value. So shifting is done like this:

$ exiftool '-subsectimeoriginal+<filesequence' /Users/jrb8/Desktop/sortphotos_test/ -overwrite_original_in_place

But if you want to start from zero, and don't care about the existing values, the "+" isn't necessary:

$ exiftool '-subsectimeoriginal<filesequence' /Users/jrb8/Desktop/sortphotos_test/ -overwrite_original_in_place

- Phil
Title: Re: How to increment file creation date from file to file
Post by: suplemereader on January 21, 2019, 05:34:33 PM
Thank you Phil, helped a lot!

Is there a way with exiftool to have filesequence generate x number of digits and leading zeros?

For example, if I wanted a 3-digit filesequence result...
iterations 0-9
000, 001, --> 009

iterations 10-99
010, 011,  --> 099

iterations 100-999
100, 101,  --> 999
Title: Re: How to increment file creation date from file to file
Post by: StarGeek on January 21, 2019, 06:31:15 PM
See this this previous post (https://exiftool.org/forum/index.php/topic,7974.msg40666.html#msg40666) for three examples.  Just change FileIndex to FileSequence and change the 5 to 3.
Title: Re: How to increment file creation date from file to file
Post by: suplemereader on January 22, 2019, 10:44:24 PM
Hi Stargeek,

Thank you for the pointer to that posting, but I am still missing something.

After setting the SubSecTime manually on my test files, I tried some of those solutions with the following results:

exiftool -P '-subsectimeoriginal<${filesequence;$_=substr('000'.$_,-3)}' '-subsectimedigitized<${filesequence;$_=substr('000'.$_,-3)}' /Users/jrb8/Desktop/sortphotos_test_2 -overwrite_original_in_place

$ exiftool -subsectime -subsectimeoriginal -subsectimedigitized /Users/jrb8/Desktop/sortphotos_test_2
======== /Users/jrb8/Desktop/sortphotos_test_2/001.jpg
Sub Sec Time                    : 1
Sub Sec Time Original           : 00
Sub Sec Time Digitized          : 00
======== /Users/jrb8/Desktop/sortphotos_test_2/011.jpg
Sub Sec Time                    : 11
Sub Sec Time Original           : 01
Sub Sec Time Digitized          : 01
======== /Users/jrb8/Desktop/sortphotos_test_2/111.jpg
Sub Sec Time                    : 111
Sub Sec Time Original           : 02
Sub Sec Time Digitized          : 02



I was hoping to get a 3-digit value for both SubSecTimeOriginal and SubSecTimeDigitized. Anything jump out to you as a mistake in my syntax?
Title: Re: How to increment file creation date from file to file
Post by: StarGeek on January 23, 2019, 12:48:19 AM
Since you appear to be on Mac/Linux, you probably need double quotes around the 0s.  Otherwise, it looks like bash gets in the way and simplifies string 000 to numeric 0.  Just a guess though.
Title: Re: How to increment file creation date from file to file
Post by: Phil Harvey on January 23, 2019, 07:15:16 AM
Yup.  The quoting is the problem.  It isn't bash, but Perl that is doing it.  Without the quotes around "000", it is interpreted as a number.

- Phil
Title: Re: How to increment file creation date from file to file
Post by: suplemereader on January 23, 2019, 02:50:52 PM
Gentlemen,

Thank you both kindly. It's working like a charm now.
Title: Re: How to increment file creation date from file to file
Post by: ceej on March 23, 2021, 07:42:52 PM
Newbie here; very rusty programmer; have also read similar topic in StackExchange but cant find it now. Some of what I include here is from there.  Anyway -

I have a directory of several thousand scanned photographs.
Each has a metadata value of DateCreated/DateTimeOriginal = yyyy/mm/dd-00:00:00 (however it is actually encoded) that was written with each scan.  Large 'bunches' of photographs have the same value.
The date is important - it is 'pretty accurate' and I'd like to keep it.
But the time values for all of the files is 00:00:00

What I would like to do is set the time value to successive 10-second increments.  (this is primarily to insure that various photo apps/services will display the photos in the scanned sequence)
Since there are 24*360=8640 10-second increments in a day, I do not have enough photos of the same day that there would be a conflict.

And I do not need to reset the time value whenever I start a new date (though that would be an added bonus).

So will the (pseudo) code below work?

@echo off
setlocal EnableDelayedExpansion (copied from an example; not clear i need it)
n=0
for %%f in (*.jpg) do (
    echo %%f
   n=n+10
    rem Assign time increment
    exiftool -DateTimeOriginal+="00:00:n" %%f  (not sure if time format is correct)
)

Big question, I guess is: as n grows, will the "00:00:n" take on the proper form?  That is:
n=50   "00:00:n" = 00:00:50
n=60   "00:00:n" = 00:01:00
n=120   "00:00:n" = 00:02:00
n=600   "00:00:n" = 00:10:00
n=3599   "00:00:n" = 00:59:59
n=3600   "00:00:n" = 01:00:00
n=3601   "00:00:n" = 01:00:01
n=8639   "00:00:n" = 23:59:59
n=8640   "00:00:n" = 00:00:00 and will it bump the day number?

If I wanted 1-minute increments, would I use n+n+1 and "00:n:00" ?
Thanks,
  -ceej
Title: Re: How to increment file creation date from file to file
Post by: StarGeek on March 23, 2021, 10:07:26 PM
Quote from: ceej on March 23, 2021, 07:42:52 PM
Newbie here; very rusty programmer; have also read similar topic in StackExchange but cant find it now. Some of what I include here is from there.

Here's (https://photo.stackexchange.com/questions/60342/how-can-i-incrementally-date-photos) the post you're looking for.  It's based upon the second post (https://exiftool.org/forum/index.php?topic=5621.msg27394#msg27394) in this thread.

QuoteSo will the (pseudo) code below work?

Running exiftool in a loop is always a bad idea, as its biggest performance hit is the startup time.  Running it over several thousand images could take hours this way when letting exiftool do the work itself would take a fraction of that time.  See Common Mistake #3 (https://exiftool.org/mistakes.html#M3)

The command you want to run would be the one listed on the StackExchange post, but changing the single quotes to double quotes since you appear to be on Windows (but use single quotes in PowerShell, I believe)
exiftool "-datetimeoriginal+<0:0:${filesequence}0" DIR

QuoteBig question, I guess is: as n grows, will the "00:00:n" take on the proper form?

Yes.  Using the format 0:0:n will increment the the timestamp by the number of seconds, no matter if the number is 1 or 31.6 million (about a year)  .  In the above example, it uses the FileSequence tag, which is a counter incremented for each source file (see Extra tags (https://exiftool.org/TagNames/Extra.html)).

QuoteIf I wanted 1-minute increments, would I use n+n+1 and "00:n:00" ?

You would use
"-datetimeoriginal+<0:${filesequence}:0"
in the above command.

For further details on shifting times with exiftool, see ExifTool Date/Time Shift Module (https://exiftool.org/Shift.html).
Title: Re: How to increment file creation date from file to file
Post by: Luuk2005 on March 24, 2021, 03:22:05 AM
Greetings Ceej, if there is not too many different dates, you can also try a batch like this...

@echo off
:: Its important all files to be in 1-folder with NO sub-folders
:: Set your FolderPath
cd /d "X:\Your\FolderPath"
:: Exit if finding any sub-folders
dir /b/ad . 2>nul |Findstr /r "^.">nul &&Exit
echo.
echo. Setting all times to 00:00:00
exiftool -overwrite_original -DateTimeOriginal"<${DateTimeOriginal;s/ .*//}000000" .
echo.
echo. Moving different-dates into sub-folders like yyyy-mm-dd
exiftool -overwrite_original -d "%%Y-%%m-%%d"  -Directory"<DateTimeOriginal" .
echo.
echo. Slowly incrementing times per sub-folder
:: This very slow because starts/stops for each folder!!
For /r %%A in (.) do @exiftool -overwrite_original -DateTimeOriginal+"<0:0:${FileSequence;$_*=10}" "%%A"
:: Move all sub-files back to parent
For /r %%A in (*.*) do @move "%%A" . 1>nul
:: Delete empty sub-folders
For /r %%A in (.) do rd "%%A" 2>nul
pause


Its to make your times in 10-second increments, but restarting at 00:00:00 for each new date.
But if there is many different dates, then this "bonus" part will probably not be worth waiting for!
This because StarGeek's one command creates the exact same order, but is so much faster (I just like the challenge for 'bonus').
It does also assume that your dates are inside $DateTimeOriginal.

*Edit: Added code to exit if finding any sub-folders, because what if someone else finds this, and does not follow advice?
Lol, at the end it moves all their files up one directory, and then deletes the empty folders!
 
Title: Re: How to increment file creation date from file to file
Post by: StarGeek on March 24, 2021, 10:57:10 AM
Quote from: ceej on March 23, 2021, 07:42:52 PM
And I do not need to reset the time value whenever I start a new date (though that would be an added bonus).

I did miss this part.  I'm not sure how to do this without some scripting like Luuk2005's answer.

But instead of moving the files, using the HardLink tag from the Extra tags page (https://exiftool.org/TagNames/Extra.html) to create a temporary directory structure would be better.   You can then delete the entire temp directory.

My edits to Luuk2005's batch file. This might require some tweaks with regards to the Temp directory setup, as I don't really do Windows batch files.  The idea I'm trying to set up is a directory called Temp in the same parent directory as the one being processed.
echo. Moving different-dates into sub-folders like yyyy-mm-dd
exiftool -overwrite_original -d "%%Y-%%m-%%d"  "-Directory<../Temp/$DateTimeOriginal/%%F" .
echo. Slowly incrementing times per sub-folder
:: This very slow because starts/stops for each folder!!
For /r %%A in (..\Temp\) do @exiftool -overwrite_original -DateTimeOriginal+"<0:0:${FileSequence}0" "%%A"
:: Delete empty sub-folders
del /S ..\Temp\
pause
Title: Re: How to increment file creation date from file to file
Post by: ceej on March 24, 2021, 03:49:49 PM
Wow!  I am awed at the quick and detailed responses.  I want to say a sincere thank you.
Below is the test program that I finally got to run (spent a LONG TIME before I discovered the need for ! instead of % inside the FOR loop).  And I tested with larger value of seconds to verify my supposition that it works.  I was only running a small batch of files, and getting  maybe 3 or 4 a second, so could live with that.  But I'll dive into the responses - now that I see that I can DO it, I hope to LEARN it.  (next effort will be to see if I can learn how to set fileCreateDate=exifCreateDate at the same time).
Again, my thanks.
  -ceej


echo off
setlocal ENABLEDELAYEDEXPANSION ENABLEEXTENSIONS
set /A seconds = 0
echo Start exiftool loop
for %%f in (*.jpg) do ( pause
set /A seconds = !seconds! + 10
echo FILE = %%f  SECONDS is !seconds!
rem Assign time increment
exiftool -CreateDate+="00:00:!seconds!" %%f
)
echo End of Program
pause
EXIT
Title: Re: How to increment file creation date from file to file
Post by: ceej on March 24, 2021, 04:01:57 PM
Oh, and what is the difference between += and +<, particularly as it applies to my exiftool command, but also in general.
tx,
  -ceej
Title: Re: How to increment file creation date from file to file
Post by: StarGeek on March 24, 2021, 04:42:14 PM
Quote from: ceej on March 24, 2021, 04:01:57 PM
Oh, and what is the difference between += and +<, particularly as it applies to my exiftool command, but also in general.

See Common Mistake #5c (https://exiftool.org/mistakes.html#M5)
Title: Re: How to increment file creation date from file to file
Post by: Luuk2005 on March 25, 2021, 06:02:34 AM
Greetings everyone!
@StarGeek: Your improvement for a temp-folder is to be the best solution, but I cant edit the post anymore!????
Im thinking it can save people who like to remove the exit part, so then Im not getting blamed for all the trouble!
The improved batch does settle all conducted-files in a temp-folder, so then only conducted-files get moved back.

@Ceej: The latest For-Loop that you're now posting, does conduct exactly like StarGeek's one-command format...
exiftool -ext jpg -overwrite_original -CreateDate+"<0:0:${FileSequence;$_+=1;$_*=10}" "FolderPath"
Except the For-Loop is much slower, because its telling the exiftool to start/stop for each and every *.jpg
Also to quote %%f in case of names with spaces, and DelayedExpansion will not conduct the names with "!".
Both methods invented the same results, but this experiment presents the speed difference using 100 test-files...
     1-command:  0-min, 12-secs  (slow laptop)
     For-Loop:      6-min, 10-secs

Of course, the difference is to be much, much, greater with many hundreds or more of files!
I think of it like a train that goes really fast, but then having to start/stop for each jpg-passenger.
So at least make the passengers go to a folder, so then exiftool only has to stop at the folder stations.

Lol, instead of stopping and starting for each and every passenger waiting alongside at the rails.
Im also tested my batch for speed, but really that depends more on how many different-dates there can be?
The 100 test-files only had 4 different-dates, and the total time to get the "bonus" part was still 45-seconds.

So Im just guessing its probably about 10-seconds per different date, on a slow computer like mine. 
Also, it first resets the times to 00:00:00, because Im not sure if some files cannot already be like that?

If you like to experiment, you can change the begin-time from 10 to 00 by moving your set command under exiftool.
But of course, its still to be the same speed, and to give the same results as the one-command format...
exiftool -ext jpg -overwrite_original -CreateDate+"<0:0:${FileSequence}0" "FolderPath"

So if you like to experiment in the batch, its changing {FileSequence;$_+=1;$_*=10} <==> {FileSequence}0
Lol, never mind, I cant edit the batch, so its changing {FileSequence;$_+=1;$_*=10} <==> {FileSequence;$_*=10}

This was a hard part for me to understand, not realizing how long the start-up is, compared to the running speed.
Because with cmd-commands inside the For-Loop, you hardly even notice a difference, unless you're the Flash.
But for programs to look up 'libraries' and stuff, the difference is amazing, especially when looping them for each file.
There is something called "stay open", but I dont know how it works yet????
Title: Re: How to increment file creation date from file to file
Post by: ceej on March 25, 2021, 10:14:26 PM
Once again, to all, thanks very much.  I finally "got" filesequence as a variable, much like the index of the FOR loop.  Head Slap!  Then so much made sense.  Also found additional (sub)pages in the documentation and was able to clear some more fog.  (Although the different names that are used for the same fields by various operating systems and programs is enough to drive one mad!).

Luuk2005 - thanks so much for your diving into the bonus!  Turns out I have many dates, and upon reflection, the need to restart at a new date was really not there.  However, I really appreciate your command for setting just the time value to 00:00:00 - and I even understood it.

Phil - thanks for the links to answers.  Although 'getting the answer' is quicker, the learning is less.  But I always appreciate being pointed to the page, at least.  So thanks again for your help as well as this awesome program.

Stargeek - ditto for your help.  When I understood how to have exiftool do what i wanted in just a single command, I fully grasped the time difference that it would take in a loop!

Below is what I ran, and the output that I got.
Can someone help with:
1. are these primarily exiftool 'fixing things' as it gathers data during its pass?
2. can I assume that warnings are just that - and I need not obsess on them?
3. It says 1 image file unchanged - but how do I know which?

and finally,
4. Just curious, is or can there be some problem with using DateTimeOriginal twice in this command:
exiftool -overwrite_original -fileOrder DateTimeOriginal "-DateTimeOriginal+<0:0:${filesequence}0" *.jpg

Thanks once again - all of what I wanted got done!
  -ceej


T:\Scanned_Images_Repository-1>exiftool -overwrite_original -DateTimeOriginal"<${DateTimeOriginal;s/ .*//}000000" *.jpg
Warning: [minor] Ignored empty rdf:Alt list for dc:description - 1960-12-15-P-004.jpg
Warning: [Minor] Can't handle XMP attribute 'xml:lang' - 1998-08-23-P-042.jpg
Warning: [Minor] Can't handle XMP attribute 'xml:lang' - 1999-08-25-P-009.jpg
Warning: [minor] Entries in IFD0 were out of sequence. Fixed. - F97-P-0039-1_edited-1.jpg
3751 image files updated

T:\Scanned_Images_Repository-1>exiftool -overwrite_original -fileOrder FileName "-DateTimeOriginal+<0:0:${filesequence}0" *.jpg
Warning: [Minor] Can't handle XMP attribute 'xml:lang' - 1998-08-23-P-042.jpg
Warning: [Minor] Can't handle XMP attribute 'xml:lang' - 1999-08-25-P-009.jpg
3750 image files updated
    1 image files unchanged

PS
It is so satisfying to open the directory in XNView and scroll down - watching the times creep up from midnight in 10-second increments!


Title: Re: How to increment file creation date from file to file
Post by: StarGeek on March 25, 2021, 11:10:21 PM
Quote from: ceej on March 25, 2021, 10:14:26 PM
1. are these primarily exiftool 'fixing things' as it gathers data during its pass?

The minor warnings listed are probably not "fixed" except for the "Entries in IFD0 were out of sequence" as your command is most likely writing to EXIF tags and not the XMP tags where the warnings are popping up. Those might require adding the -m (-ignoreMinorErrors) option (https://exiftool.org/exiftool_pod.html#m--ignoreMinorErrors) if you were to write to the XMP data to fix.  Odds are that none of those will prevent reading the data.

Quote2. can I assume that warnings are just that - and I need not obsess on them?

For the ones listed, yeah, no real need to obsess over them.  But if you wanted you could try running the command listed in FAQ #20 (https://exiftool.org/faq.html#Q20) to re-write all the metadata.  Though if you have some unusual metadata that exiftool doesn't know about (sorta rare), that could be lost. 

Quote3. It says 1 image file unchanged - but how do I know which?

It's the first one.  FileSequence starts at 0, so the first file processed would add 0 seconds, which would be unchanged from the original value.

Quote4. Just curious, is or can there be some problem with using DateTimeOriginal twice in this command:
exiftool -overwrite_original -fileOrder DateTimeOriginal "-DateTimeOriginal+<0:0:${filesequence}0" *.jpg

No.  The first occurrence is the second argument of the -FileOrder option (https://exiftool.org/exiftool_pod.html#fileOrder-NUM---TAG).  It tells exiftool to make a pass over all the files to extract the DateTimeOriginal value for each file, sort all the files by that tag, and process them in that order.  It might be unnecessary, depending upon the file names, as it will take a bit longer because it has to pass over all the files to get the data first and then run again to actually process the files.  It's up to you to decide if it might be needed.  For me, using it is a requirement in situations like this because I use Stablebit DrivePool and the file list passed to exiftool is not alphabetized like it would be for a non-pooled drive.
Title: Re: How to increment file creation date from file to file
Post by: oivindmi on October 04, 2021, 06:21:14 PM
Quote from: Phil Harvey on February 21, 2014, 10:53:28 AM
Hi Arni,

This is a bit tricky, but you could do this with 2 commands:

1) First set all images to the same date/time:

exiftool -datetimeoriginal="2014:02:21 10:48:00" DIR

2) Increment the times by one additional minute for each file:

exiftool '-datetimeoriginal+<0:$filesequence' DIR

where DIR is a directory containing the images.  (You must use single quotes instead of double quotes around the argument in the second command since you are running on a Mac.) The +< syntax copies the value of other tags and uses it to increment the target tag, and the format for incrementing minutes is "0:MM".  Here, I have used the Extra (https://exiftool.org/TagNames/Extra.html) FileSequence tag to give me the incrementing values that we need.

On a Mac, the files will be processed in alphabetical order, so you don't need to worry about this.  (ie. specifying -fileorder FileName should not be necessary.)

- Phil

Hope it is okay to post here. I want to increment a folder of pictures by 1 sec in windows. I am getting the following command to work but I seem to have issues with the sequence Exiftool is processing pictures:

Command: exiftool "-AllDates+<0:0:$filesequence" "folder"  -overwrite_original -r

Sequence that Exiftool seems to be processing the files:
Picture (1)
Picture (10)
Picture (11)
Picture (2)
Picture (3)
Picture (4)
Picture (5)
Picture (6)
Picture (7)
Picture (8)
Picture (9)

I would really like Exiftool to process the files according to the numbering 1,2,3,4,5,6,7,8,9,10,11. This is standard renaming scheme in Windows. Is there a way for Exiftool to follow this sequence?



Title: Re: How to increment file creation date from file to file
Post by: StarGeek on October 04, 2021, 07:16:42 PM
Not really.  Exiftool will process the files as the list is delivered to it by the file system.  This is normally as if they were sorted strings which don't take into account the value of the numbers.

Your best bet is to either rename them with leading zeros or you can extract the number from the filename and add that instead of using filesequence
exiftool "-AllDates+<0:0:${Filename;m/\((\d+)\)/;$_=$1}" -overwrite_original -r /path/to/files/
Title: Re: How to increment file creation date from file to file
Post by: oivindmi on October 05, 2021, 04:24:29 AM
Thank you very much for your informative and quick reply! Very much appreciated! I think I can definetely work with this :)

One quick question, is it possible to add a multiple on this formula? So that the extracted number of seconds is multiplied by a given number? (3 or 5 or7 etc.)

Also, if I want to understand how your formula is built up, what is the best resource to understand what each command does? I have a rudimentary understanding of Exiftool commands, but always get lost when the commands get as complicated as your example.
Title: Re: How to increment file creation date from file to file
Post by: StarGeek on October 05, 2021, 11:06:14 AM
Quote from: oivindmi on October 05, 2021, 04:24:29 AM
One quick question, is it possible to add a multiple on this formula? So that the extracted number of seconds is multiplied by a given number? (3 or 5 or7 etc.)

Yes.  I'm a little surprised it didn't pop up in this thread earlier but it get's mentioned in the comments on this Photo StackExchange post (https://photo.stackexchange.com/a/60403/37960).  For example, this would add 3 seconds per increment.
exiftool "-AllDates+<0:0:${filesequence;$_*=3}" /path/to/files/

If you use the above Filename based command, you would change the $_=$1 part to $_=$1;$_*=3 or even $_=$1*3.

QuoteAlso, if I want to understand how your formula is built up, what is the best resource to understand what each command does?

The advanced formatting uses Perl code so some basic knowledge of Perl is helpful. There are lots of tutorial sites out there. When I was learning, I usually Googled what I wanted to try and do and added "Perl" in quotes to the search.  This often brought up code snippets from sites like StackOverflow/StackExchange that I was able to use after much trial and error.