Proof of concept of timestamping — need some help...

Discuss and share scripts and script files...
Post Reply
Marco
Posts: 2354
Joined: 27 Jun 2011 15:20

Proof of concept of timestamping — need some help...

Post by Marco »

Goal: selecting a bunch of files and, for each of them, setting the three dates to the earliest between written and last modified.

This code "works" provided that all the desired items are visible in the List and there are no additional "interfering" items.

Code: Select all

 while ("1" == "1") {
  timestamp, (compare(<datem>, <datec>, "d") == "1")?<datec>:<datem>;
  sel "+1";
 };
Needless to say, I don't like it :mrgreen:
Using property("Write", $file) and the sister property("Create", $file) would allow me to write a foreach loop, however they return UTC times (no good for non-British).
Any idea?

Oh, a trivial

Code: Select all

timestamp, (compare(<datem>, <datec>, "d") == "1")?'<datec>':'<datem>';
doesn't work either.
Tag Backup - SimpleUpdater - XYplorer Messenger - The Unofficial XYplorer Archive - Everything in XYplorer
Don sees all [cit. from viewtopic.php?p=124094#p124094]

serendipity
Posts: 3360
Joined: 07 May 2007 18:14
Location: NJ/NY

Re: Proof of concept of timestamping — need some help...

Post by serendipity »

How about:

Code: Select all

  $allitems=get("SelectedItemsPathNames", "|");
  foreach($item, $allitems, "|"){
        $datemodified=report("{Modified}",$item);
        $datecreated=report("{Created}",$item);
        timestamp, (compare($datemodified, $datecreated, "d") == "1")?$datecreated:$datemodified,$item;
  }

Marco
Posts: 2354
Joined: 27 Jun 2011 15:20

Re: Proof of concept of timestamping — need some help...

Post by Marco »

Thank you serendipity!! That's exactly what I'm looking for. I guess I deserve a RTFM for having overlooked the report() function :oops:
Just a little addendum: {Modified} needs a date pattern to work. ISO 8601 comes in handy here, so I use {Modified yyyy-mm-dd hh:nn:ss}.
Tag Backup - SimpleUpdater - XYplorer Messenger - The Unofficial XYplorer Archive - Everything in XYplorer
Don sees all [cit. from viewtopic.php?p=124094#p124094]

serendipity
Posts: 3360
Joined: 07 May 2007 18:14
Location: NJ/NY

Re: Proof of concept of timestamping — need some help...

Post by serendipity »

Marco wrote:Thank you serendipity!! That's exactly what I'm looking for. I guess I deserve a RTFM for having overlooked the report() function :oops:
Just a little addendum: {Modified} needs a date pattern to work. ISO 8601 comes in handy here, so I use {Modified yyyy-mm-dd hh:nn:ss}.
Thanks for the addendum, did not know that.

Post Reply