I cannot change FileModifyDate in Linux(Synology NAS)

Started by victoryaaa, January 30, 2019, 11:50:03 AM

Previous topic - Next topic

victoryaaa

Hello.

I cannot change FileModifyDate in Linux(Synology NAS DS218+) like the following.
(I can change other time like datetimeoriginal.)
In addition, it(FileModifyDate change) is working well in Window.
Would you please let me know how to change FileMofidyDate in Linux(Synology NAS DS218+)?

Thank you.

-----------------------------------------------------------------------------------------------------------------------------------
// 1. Original Information
.../Image-ExifTool-11.26$ ./exiftool  ../DSLR/Test/20181231_135333.jpg | grep "20"
File Name                       : 20181231_135333.jpg
File Modification Date/Time     : 2019:01:31 00:54:08+09:00
File Access Date/Time           : 2019:01:31 01:31:52+09:00
File Inode Change Date/Time     : 2019:01:31 01:31:52+09:00
Modify Date                     : 2018:12:31 13:53:33
Exif Version                    : 0220
Date/Time Original              : 2018:12:31 13:53:33
Create Date                     : 2018:12:31 13:53:33
Time Stamp                      : 2018:12:31 13:53:33+09:00

// 2. Try to change FileModifyDate
.../Image-ExifTool-11.26$ ./exiftool "-filemodifydate<datetimeoriginal" ../DSLR/Test/20181231_135333.jpg
    1 image files updated

// 3. FileModifyDate is not changed
.../Image-ExifTool-11.26$ ./exiftool  ../DSLR/Test/20181231_135333.jpg | grep "20"
File Name                       : 20181231_135333.jpg
File Modification Date/Time     : 2019:01:31 00:54:08+09:00
File Access Date/Time           : 2019:01:31 01:38:54+09:00
File Inode Change Date/Time     : 2019:01:31 01:38:54+09:00
Modify Date                     : 2018:12:31 13:53:33
Exif Version                    : 0220
Date/Time Original              : 2018:12:31 13:53:33
Create Date                     : 2018:12:31 13:53:33
Time Stamp                      : 2018:12:31 13:53:33+09:00

// 4. Try to change DateTimeOriginal
.../Image-ExifTool-11.26$ ./exiftool "-datetimeoriginal<filemodifydate" ../DSLR/Test/20181231_135333.jpg
    1 image files updated

// 5. It is changed well.
.../Image-ExifTool-11.26$ ./exiftool  ../DSLR/Test/20181231_135333.jpg | grep "20"
File Name                       : 20181231_135333.jpg
File Modification Date/Time     : 2019:01:31 01:40:30+09:00
File Access Date/Time           : 2019:01:31 01:40:31+09:00
File Inode Change Date/Time     : 2019:01:31 01:40:30+09:00
Modify Date                     : 2018:12:31 13:53:33
Exif Version                    : 0220
Date/Time Original              : 2019:01:31 00:54:08
Create Date                     : 2018:12:31 13:53:33
Time Stamp                      : 2018:12:31 13:53:33+09:00


StarGeek

You may have to wait until Phil (the author) comes back from vacation.  The "-filemodifydate<datetimeoriginal" should work, though on linux you might try using single quotes instead of double quotes. 

When editing metadata internal to the file (such as DateTimeOriginal) rather than filesystem data (such as FileModifyDate), you might see if the -P (preserve) option preserves the FileModifyDate.
* Did you read FAQ #3 and use the command listed there?
* Please use the Code button for exiftool code/output.
 
* Please include your OS, Exiftool version, and type of file you're processing (MP4, JPG, etc).

victoryaaa

I have tried using single quotes instead of double quotes but it does not work.
I am give you more information.
My OS is Linux and exiftool version is 11.26.
In addition, GPS coords has no problem.

Phil Harvey

I just tried this on Linux:

% exiftool a.jpg -filemodifydate -datetimeoriginal
File Modification Date/Time     : 2014:10:27 06:47:41-04:00
Date/Time Original              : 1998:05:01 21:33:18
% exiftool a.jpg "-filemodifydate<datetimeoriginal"
    1 image files updated
% exiftool a.jpg -filemodifydate -datetimeoriginal
File Modification Date/Time     : 1998:05:01 21:33:18-04:00
Date/Time Original              : 1998:05:01 21:33:18


Check that you have write permission, but if you didn't I would expect an error.

- Phil


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

victoryaaa

As you can see the following #2, it has write permission.

I found that the problem happens in only sysnology NAS.
I have checked it in ubuntu and it has no problem.
I think it has some difference although it is the same linux OS.

In addition, I have found the post(#1 link) and Nexius2 may have a lot of experience to use your exiftool in synology NAS.
Therefore I will send him the direct message and inquire that he has same problem and ask him to see this post.

Would you please help me with him?
Thank you for your support.

--------------------------------------------------------------------------------------------------------
#1. Post Link
--------------------------------------------------------------------------------------------------------
https://exiftool.org/forum/index.php/topic,6157.msg30362.html#msg30362

--------------------------------------------------------------------------------------------------------
#2. Test Result
--------------------------------------------------------------------------------------------------------
admin@hss218:/volume1/photo_DSLR_CR2/Image-ExifTool-11.26$ ls -l
total 72108
-rwxrwxrwx+ 1 admin users  3874621 Dec 19 00:36 20181011_192439.jpg
-rwxrwxrwx+ 1 admin users 69101556 Dec 18 01:59 20181011_193120.mp4
...
admin@hss218:/volume1/photo_DSLR_CR2/Image-ExifTool-11.26$ ./exiftool -filemodifydate -datetimeoriginal 20181011_192439.jpg
File Modification Date/Time     : 2018:12:19 00:36:58+09:00
Date/Time Original              : 2018:10:11 19:24:39
admin@hss218:/volume1/photo_DSLR_CR2/Image-ExifTool-11.26$ ./exiftool "-filemodifydate<datetimeoriginal" 20181011_192439.jpg
    1 image files updated
admin@hss218:/volume1/photo_DSLR_CR2/Image-ExifTool-11.26$ ./exiftool -filemodifydate -datetimeoriginal 20181011_192439.jpg
File Modification Date/Time     : 2018:12:19 00:36:58+09:00
Date/Time Original              : 2018:10:11 19:24:39

Nexius2

Hello,
your commands are good and working!
just made a test on my side.

exiftool 2005-02-15_13-19-32.jpg
File Modification Date/Time     : 2017:07:05 13:19:39+02:00
Date/Time Original              : 2005:02:15 13:19:32

exiftool "-filemodifydate<datetimeoriginal" 2005-02-15_13-19-32.jpg

exiftool 2005-02-15_13-19-32.jpg
File Modification Date/Time     : 2005:02:15 13:19:32+01:00
Date/Time Original              : 2005:02:15 13:19:32

I guess tou have a problem with your Exiftool version.
wich one are you using?
I would suggest you use mine ;-)
https://www.cphub.net/?id=40&pid=801
beta and production release available, you just have to add the repo to your nas but I'd guess you know how to



victoryaaa

Hello,

It has the same problem although I install your lattest beta version.
In addition, I have found something strange.
I made the shell script like the following.

-----------------------------------------------------------------
#!/bin/bash

echo "Before"
echo $(exiftool -filemodifydate -datetimeoriginal 20181011_192439.jpg)
exiftool "-filemodifydate<datetimeoriginal" 20181011_192439.jpg
echo "After"
echo $(exiftool -filemodifydate -datetimeoriginal 20181011_192439.jpg)
sleep 1
echo $(exiftool -filemodifydate -datetimeoriginal 20181011_192439.jpg)
sleep 1
echo $(exiftool -filemodifydate -datetimeoriginal 20181011_192439.jpg)
sleep 1
echo $(exiftool -filemodifydate -datetimeoriginal 20181011_192439.jpg)
-----------------------------------------------------------------

The result is the following.
It means that filemodifydate changed well originally but it was reverted soon.
My NAS model is DS218+ and DSM version is DSM 6.2.1-23824 Update 4.
Please recommend what I should do to figure the issue more.

-----------------------------------------------------------------
admin@hss218:/volume1/photo/Test$ ./test.sh
Before
File Modification Date/Time : 2018:12:19 00:36:58+09:00 Date/Time Original : 2018:10:11 19:24:39
    1 image files updated
After
File Modification Date/Time : 2018:10:11 19:24:39+09:00 Date/Time Original : 2018:10:11 19:24:39
File Modification Date/Time : 2018:12:19 00:36:58+09:00 Date/Time Original : 2018:10:11 19:24:39
File Modification Date/Time : 2018:12:19 00:36:58+09:00 Date/Time Original : 2018:10:11 19:24:39
File Modification Date/Time : 2018:12:19 00:36:58+09:00 Date/Time Original : 2018:10:11 19:24:39
-----------------------------------------------------------------

Nexius2

Hello, did you try with other files?
your issue seams to be with something else then Exiftool.
and your saying you can change that same file on ubuntu?
where is your file on the nas and what packages do you have running?

victoryaaa

Hello,

All of files have same problem.
Yes, same file is changed well in ubuntu.
My files are in normal photo path(/volume1/photo/) on the nas.
And, I just run file station and photo station.
I have tried it after rebooting nas and not starting any package, but the problem is same.
I think some background program may effect the problem.

Thank you.

Nexius2

Yes, I would say the same.
or your files have a particuliar problem.
coud you send me a file so I can have a try?
edit and color the photo if you dan't wan't it to be seen ;-)
and have a try again after the edit, we never now :-D

victoryaaa

Hello,
The cause of the problem was Drive package.
After Stopping Drive package, filemodifydate is changed well by exiftool.
Drive package may revert filemodifydate whenever I try to change it by exiftool.
Your hint helps me solving the problem.
I owe you big time.
Thank you very much.

dima

Unfortunately for me the problem is not yet solved.
If I stop the drive package, I can change the file. If I switch on the drive package again, the file is reset to the old date.

Is that your problem too?

admin@NAS:/var/services/homes/Admin$ exiftool Drive/Moments/2007/2007-08-06/20070806_12h08m29s.avi | grep Date
File Modification Date/Time     : 2020:01:26 20:02:58+01:00
File Access Date/Time           : 2020:02:16 09:28:14+01:00
File Inode Change Date/Time     : 2020:02:16 09:28:14+01:00
Date/Time Original              : 2007:08:06 12:08:29

admin@NAS:/var/services/homes/Admin$ cd /var/services/homes/Admin/Drive/Moments/2007/2007-08-06/

admin@NAS:/var/services/homes/Admin/Drive/Moments/2007/2007-08-06$ cp 20070806_12h08m29s.avi /tmp

admin@NAS:/var/services/homes/Admin/Drive/Moments/2007/2007-08-06$ cd /tmp

admin@NAS:/tmp$ exiftool "-filemodifydate<datetimeoriginal" -ext avi 20070806_12h08m29s.avi
    1 image files updated
admin@NAS:/tmp$ exiftool 20070806_12h08m29s.avi | grep Date                             
File Modification Date/Time     : 2007:08:06 12:08:29+02:00
File Access Date/Time           : 2007:08:06 12:08:29+02:00
File Inode Change Date/Time     : 2020:02:16 09:33:15+01:00
Date/Time Original              : 2007:08:06 12:08:29

admin@NAS:/tmp$ cp 20070806_12h08m29s.avi /var/services/homes/Admin/Drive/Moments/2007/2007-08-06

admin@NAS:/tmp$ exiftool /var/services/homes/Admin/Drive/Moments/2007/2007-08-06/20070806_12h08m29s.avi | grep Date
File Modification Date/Time     : 2020:01:26 20:02:58+01:00
File Access Date/Time           : 2020:02:16 09:33:55+01:00
File Inode Change Date/Time     : 2020:02:16 09:33:55+01:00
Date/Time Original              : 2007:08:06 12:08:29
admin@NAS:/tmp$

greybeard

#12
Try this sequence of commands:

cd (to put yourself in home directory)

mv  /var/services/homes/Admin/Drive/Moments/2007/2007-08-06 . (to rename your subdirectory out of the Moments directory)

Go into the Moments app and reindex so that Moments no longers sees the video file

exiftool "-filemodifydate<datetimeoriginal" -ext avi -r 2007-08-06 (to change the FileModifyDate to DateTimeOriginal in your video file)

mv 2007-08-06 /var/services/homes/Admin/Drive/Moments/2007 (to rename the subdirectory back into the Moments subdirectory)

Go into the Moments app and reindex again so that Moments now has visibility of the video files with the changed date

(No need to stop the Drive app at any time in this process)

dima

I tested it. I can change the modification date as long as the Video is off the "Drive"

If I copy the Video back into the directory, the modification date is immediately reset.

The Video is displayed again at the top in Moments.

greybeard

OK I'm out of ideas - this approach worked for me.

If you only have a few videos I suppose you could export them - delete them from Moments - change the date and import back.

But this would be time consuming if you have a lot of videos.