Copy Creation Date (-createdate) to File Modification date (-filemodifydate)

Started by garrickk, January 13, 2016, 05:38:34 PM

Previous topic - Next topic

Phil Harvey

Thanks for the post, but I still don't understand a couple of things:

1. Do you have any idea why utime would behave differently when run as administrator?  Are your PERL5LIB settings the same in both cases?

2. Why is the error reporting line 5399?  The utime call is on line 5913 in ExifTool 10.08.

- 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 ($).

mif

Quote1. Do you have any idea why utime would behave differently when run as administrator?  Are your PERL5LIB settings the same in both cases?

I don't know.  How would I check PERL5LIB settings?

Quote2. Why is the error reporting line 5399?  The utime call is on line 5913 in ExifTool 10.08.

This is interesting.  /opt/lib/perl5/5.22/Image/ExifTool.pm contains $VERSION = '10.08';, however, /opt/lib/perl5/5.22/Image/ExifTool/Writer.pl does not have any information in the file to associate it with any specific version.

The library and perl were installed using entware-ng.

Phil Harvey

Quote from: mif on April 20, 2017, 10:37:14 AM
How would I check PERL5LIB settings?

printenv PERL5LIB

Quote/opt/lib/perl5/5.22/Image/ExifTool.pm contains $VERSION = '10.08';, however, /opt/lib/perl5/5.22/Image/ExifTool/Writer.pl does not have any information in the file to associate it with any specific version.

True.  Here is what Writer.pl should look like for version 10.08:

% ls -l Image-ExifTool-10.08/lib/Image/ExifTool/Writer.pl
-rw-r--r--  1 phil  staff  267457 Dec 22  2015 Image-ExifTool-10.08/lib/Image/ExifTool/Writer.pl
% md5 Image-ExifTool-10.08/lib/Image/ExifTool/Writer.pl
MD5 (Image-ExifTool-10.08/lib/Image/ExifTool/Writer.pl) = fc32e5a53d818fc94ae7dcd543f1f3af


Also note that I have just released ExifTool 10.50 with improved handling of utime errors.

QuoteThe library and perl were installed using entware-ng.

I suggest trying to un-install this version, then install 10.50 using the standard install technique.

- 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 ($).

mif

PERL5LIB is not set

I did a diff of Writer.pl on my system and 10.08 download and it looks like they stripped all first column comments.  Otherwise the files are the same.

I will see if I can use the newest version.

mif

I just tried version 10.50 and it works.

exiftool now displays:

Warning: [minor] Tag 'DateTimeOriginal' not defined - /media/IMG_20170415_105249.MOV
Warning: The futimes function is unimplemented - /media/IMG_20170415_105249.MOV


and continues to work.

Phil Harvey

So the -P option likely isn't working for you, but at least the new version now continues running if futimes is missing.  Unforunately it still doesn't answer the question about why futimes isn't available for you when not running as administrator.

- 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 ($).

Phil Harvey

I have come up with a patch that should work around this problem and allow file times to be set even when futimes is not available.  ExifTool 10.51 will contain this patch.

- 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 ($).

mif


Phil Harvey

...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 ($).

mif

I gave it a few tries.  Here are the results:

The original command no longer warns me about unimplemented futimes but -P still does not work.  The date/time is set to the current date/time.

I tried the following command on the destination directory:

exiftool "-filemodifydate<CreationDate" /destination

It works and sets the date/time to the CreationDate

The original command is executed on files that belong to a different user/group, but all users have read/write permissions.
The destination file is owned by the executing user/group.

I tried changing the owner/group of the source file to the executing user but -P still did not work.

For testing, I used a file where I set the date/time using the above exiftool command.

Phil Harvey

Darn.  OK, thanks.  I'll have another look at this then.  It is a bit difficult because I can't replicate your situation on any of my machines, but maybe you have given me enough information to figure this out.

- 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 ($).

mif

I did more testing.

I did change a few things.  I simplified my test.  I copied .MOV file to my home directory and I used exiftool "-FileModifyDate<CreateDate" ~ to test.

.MOV file mode is rw for owner, group, users

.MOV file is owned by executing user and group.

Executing as the owner (admin).

version 10.50 failed with futimes unimplemented error.
version 10.51 worked.

.MOV file is owned by another user.

Executing as a non-owner user (admin).

version 10.50 and 10.51 failed with a generic error.

Executing as the owner (non-admin)

version 10.50 failed with futimes unimplemented error.
version 10.51 worked.

This tells me that your patch does fix the futimes problem.

I also tested the -P option and it appears to work as well.  I think in my previous test I made a mistake.  I think I copied the files before testing and did not realize the copy would update modified date.

Phil Harvey

Thank you very much for looking into this in more detail.  This saves me a lot of head scratching.

I'm glad to hear that it is working as expected.

- 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 ($).

Netson

I have the same question. It seems it's a same bug.

I use qnap too.

When I set FileModifyDate, it report
Warning: Error converting value for File:FileModifyDate (ValueConvInv)

I installed exiftool from Entware-ng, too, and now the version of exiftool is 10.6 in Entware-ng.

I run 'perl -we "use Time::Local"' and got a "Can't locate Time/Local.pm" error,

also, perl -we 'print utime time, time, "FILE"' returns 1.

At first, I use root user,and I change file owner to root user, It is useless.

Netson

OK, I fixed it.

the perl from Entware-ng miss module Time and File::RandomAccess.

While I installed Time and File::RandomAccess it was ok.