1 |
On Wed, Aug 29, 2018 at 08:22:31AM +0100, Neil Bothwick wrote |
2 |
> On Tue, 28 Aug 2018 22:39:51 -0400, Walter Dnes wrote: |
3 |
> |
4 |
> > Given this info, I can cobble together a short script. A "for" loop |
5 |
> > cycles through "*.jpg". Read "CreateDate" from the EXIF data, and feed |
6 |
> > it into the "touch" command, which would reset the physical file |
7 |
> > datestamp. |
8 |
> |
9 |
> You don't even need that, exiftool has a FileModifyDate tag, which is the |
10 |
> filesystem date not an EXIF tag, so you can simply set FileModifyDate to |
11 |
> CreateDate for each file. |
12 |
> |
13 |
> exiftool '-FileModifyDate<CreateDate' *.jpg |
14 |
|
15 |
Cool; I wasn't aware of that. Definitely shorter than my version... |
16 |
|
17 |
#!/bin/bash |
18 |
for filename in *.jpg |
19 |
do |
20 |
datestamp0=`exiftool -T -CreateDate ${filename} | sed "s/[ :]//g"` |
21 |
datestamp="${datestamp0:0:12}.${datestamp0:12:2}" |
22 |
touch -t ${datestamp} ${filename} |
23 |
done |
24 |
|
25 |
I tried out your command on a few directories going back to April (I |
26 |
got the phone in March) and it works fine. I have the directories |
27 |
sorted by date, and the generated datestamps match the day. Also, the |
28 |
hour:minute stamps monotonitcally rise with the image sequence numbers, |
29 |
which is a good sign. |
30 |
|
31 |
-- |
32 |
Walter Dnes <waltdnes@××××××××.org> |
33 |
I don't run "desktop environments"; I run useful applications |