Page 1 of 1

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

Posted: 25 Jan 2013 17:42
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.

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

Posted: 25 Jan 2013 18:10
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;
  }

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

Posted: 25 Jan 2013 23:14
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}.

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

Posted: 25 Jan 2013 23:42
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.