Video info to change file creation time

Features wanted...
Post Reply
tomuser
Posts: 135
Joined: 04 Dec 2009 18:52

Video info to change file creation time

Post by tomuser »

Hi and Happy New Year!

I stumbled upon issue where file timestamps are not correct, meaning if there are copy actions made outside XYplorer then it does no preserve file timestamps (modified and created) and changes them to time when copy action is made. This is one of top features (besides the many other things) I like in XYplorer that it does preserve them. Makes it easier to compare and backup files needed.

With pictures taken it's easy to use EXIF to change timestamps to correct them using XYplorer native commands. But not so easy with videos. When checking video file properties I see that there is actually original created date written into details. So my request would be that I could use this field same as EXIF with pictures to set/change file creation and modified date/time.

Image

admin
Site Admin
Posts: 64362
Joined: 22 May 2004 16:48
Location: Win8.1, Win10, Win11, all @100%
Contact:

Re: Video info to change file creation time

Post by admin »

This will return that date:

Code: Select all

text property("System.Media.DateEncoded");
You should be able to do the rest with scripting.
FAQ | XY News RSS | XY X - Forum users with the Windows version and screen scaling percentage in the Location field of their profiles get priority support.

tomuser
Posts: 135
Joined: 04 Dec 2009 18:52

Re: Video info to change file creation time

Post by tomuser »

Thanks for quick reply. Unfortunately words "scripting" and "me" do not fit into same sentence :D. Max I can do is:

Code: Select all

timestamp c, '<dateexif>';
or

Code: Select all

timestamp m, '<datec>';
So any help using property given above placed in correct way together with additional commands and attributes would be appreciated.

admin
Site Admin
Posts: 64362
Joined: 22 May 2004 16:48
Location: Win8.1, Win10, Win11, all @100%
Contact:

Re: Video info to change file creation time

Post by admin »

It's not as hard as you think. Select your MP4 file and run this through the address bar:

Code: Select all

timestamp c, property("System.Media.DateEncoded");
If the file has a "Media Created" date then the creation time will be set.
FAQ | XY News RSS | XY X - Forum users with the Windows version and screen scaling percentage in the Location field of their profiles get priority support.

tomuser
Posts: 135
Joined: 04 Dec 2009 18:52

Re: Video info to change file creation time

Post by tomuser »

Brilliant! I've tried it together with "text" in front and also together with <> marks around it to no avail. Didn't realize to remove "text" part.

But seems that this date is stored as UTC or something as if I set it to creation date then time set is 08:59 instead of 10:59 and it doesn't reflect time zone.
So I added second line to run for time shift

Code: Select all

timestamp c, property("System.Media.DateEncoded");
 timestamp c, "*", , , "2 h";

admin
Site Admin
Posts: 64362
Joined: 22 May 2004 16:48
Location: Win8.1, Win10, Win11, all @100%
Contact:

Re: Video info to change file creation time

Post by admin »

Yes, it's in UTC.

I'd rather shift it first, then stamp it:

Code: Select all

$mcdate = formatdate(property("System.Media.DateEncoded"),,h,2); timestamp c, $mcdate;
FAQ | XY News RSS | XY X - Forum users with the Windows version and screen scaling percentage in the Location field of their profiles get priority support.

jupe
Posts: 3292
Joined: 20 Oct 2017 21:14
Location: Win10 22H2 120dpi

Re: Video info to change file creation time

Post by jupe »

FYI If you use the numerical property ID instead, it is already time shifted. timestamp c, <prop #208>;

admin
Site Admin
Posts: 64362
Joined: 22 May 2004 16:48
Location: Win8.1, Win10, Win11, all @100%
Contact:

Re: Video info to change file creation time

Post by admin »

Unfortunately the number is not the same across systems. Here it is #197.
FAQ | XY News RSS | XY X - Forum users with the Windows version and screen scaling percentage in the Location field of their profiles get priority support.

tomuser
Posts: 135
Joined: 04 Dec 2009 18:52

Re: Video info to change file creation time

Post by tomuser »

Thanks :tup:

Now I need to figure out how to use it for renaming files as well. This annoys me if device makes filenames as MOV_001 or DSC_001 or similar and not using actual time stamp for it and may cause accidental loss by overwriting files with these kind of names.

(And then find a way to set it up as command line action for Stream Deck and/or Touch Portal app to make it easy only-one-button-press-action to save the world :P)

tomuser
Posts: 135
Joined: 04 Dec 2009 18:52

Re: Video info to change file creation time

Post by tomuser »

admin wrote: 01 Jan 2023 20:05
I'd rather shift it first, then stamp it:

Code: Select all

$mcdate = formatdate(property("System.Media.DateEncoded"),,h,2); timestamp c, $mcdate;
One more thing. Commands above set same timestamp for all selected files. How could I run it that each file gets their own timestamp? I tried to mess with quotation marks (single and double) but couldn't put in proper place probably.

highend
Posts: 14476
Joined: 06 Feb 2011 00:33
Location: Win Server 2022 @100%

Re: Video info to change file creation time

Post by highend »

Because you need to run it in a loop for all selected files...
One of my scripts helped you out? Please donate via Paypal

admin
Site Admin
Posts: 64362
Joined: 22 May 2004 16:48
Location: Win8.1, Win10, Win11, all @100%
Contact:

Re: Video info to change file creation time

Post by admin »

Next beta:

Code: Select all

timestamp c, '<datemedia>'; //set created date of all selected items to their "media created" date
FAQ | XY News RSS | XY X - Forum users with the Windows version and screen scaling percentage in the Location field of their profiles get priority support.

tomuser
Posts: 135
Joined: 04 Dec 2009 18:52

Re: Video info to change file creation time

Post by tomuser »

admin wrote: 02 Jan 2023 15:55 Next beta:

Code: Select all

timestamp c, '<datemedia>'; //set created date of all selected items to their "media created" date
wow, just wow :appl: :) thanks. i used to be beta-kamikaze in past but not anymore for long time. but couldn't resist on this one :D

Post Reply