Request: set file create date from another file

Discuss and share scripts and script files...
Post Reply
j_c_hallgren
XY Blog Master
Posts: 5824
Joined: 02 Jan 2006 19:34
Location: So. Chatham MA/Clearwater FL
Contact:

Request: set file create date from another file

Post by j_c_hallgren »

I'm NOT a XY scripter but I know we have a few who are great at it...and i'm wondering if anyone has created one that might work for my current situation:

Have a series of PDF files that I created from a whole bunch of other PDF files (merged each group of 6 originals into one; then cropped pages; then printed a set of consolidated PDFs) and now I'd like to set the resulting create/modif date from all this process to values from one of the originals without having to manually do each one.

The originals are from a 3 yr period and various months...I have named them with dates as part of name but would like to have dates reflect somewhat the "original" date so when I sort by that field, they will appear where they should in sequence.

Is there a way to maybe select the desired "output" file and focus on the "input" file and then execute a script that would apply the date from input to output?
I'm not needing to do a set of them at once, as one-at-a-time is fine.

BTW, the free software that I found VERY handy for the PDF merging/cropping was http://www.plotsoft.com/pdf_tools_free.html
Still spending WAY TOO much time here! But it's such a pleasure helping XY be a treasure!
(XP on laptop with touchpad and thus NO mouse!) Using latest beta vers when possible.

Stefan
Posts: 1360
Joined: 18 Nov 2008 21:47
Location: Europe

Re: Request: set file create date from another file

Post by Stefan »

j_c_hallgren wrote: Is there a way to maybe select the desired "output" file and focus on the "input" file and then execute a script that would apply the date from input to output?
I'm not needing to do a set of them at once, as one-at-a-time is fine.
I was thinking about an script like this... but i have an problem to succeed.
---------------------------
XYplorer
---------------------------
Timestamping failed.

The selected item(s) might be opened and locked by another application.
---------------------------
OK
---------------------------
EDIT: Solved
I have to specify an full file name include path for timestamp:
timestamp c, "$Created", "<curpath>\$target";
timestamp m, "$Modified", "<curpath>\$target";
instead of
timestamp c, "$Created", "$target";
timestamp m, "$Modified", "$target";
or leave the item-part empty (in case of my script)




working script for dual pane mode:
PLEASE TEST FIRST WITH SOME TEST FILES

Code: Select all


//  NOTE: Select TARGET file FIRST, then select Source file as SECOND!!!

end(getinfo("CountSelected") != 1), "Please select one (and only ONE) Target file first.";

  $input = "<curname>";
  $Created  = report("{Created}",1);
  $Modified = report("{Modified}",1);
  
  focus "PI";
  $target = "<curname>";

  $OK = confirm("
  =Copy modified and create date from source to target=<br><br>
  1. Select Target file in one panel.<br>
  2. Select Source file in other panel.<br>
  3. Execute this script.<br><br><br>
  You have chosen<br>
  Source: ""$input"" <br>
  Target: ""$target""<br><br><br>
  Continue and set date now?");

  If ($OK==0){end $OK==0;}else
  { 
      msg "ok will do now", 1;
      timestamp c, "$Created", "<curpath>\$target";
      timestamp m, "$Modified", "<curpath>\$target";
  }
  focus "PI";
Last edited by Stefan on 10 Feb 2011 22:57, edited 4 times in total.

TheQwerty
Posts: 4373
Joined: 03 Aug 2007 22:30

Re: Request: set file create date from another file

Post by TheQwerty »

As another option, though I haven't been able to test these, a set of two scripts that allows copying the date fields from one item and pasting them others.

Code: Select all

"Copy Dates"
	SetKey "<datem>", 'Modified', 'DateCopier';
	SetKey "<datec>", 'Created', 'DateCopier';
	SetKey "<datea>", 'Accessed', 'DateCopier';

"Paste Dates"
	TimeStamp 'm', GetKey('Modified', 'DateCopier');
	TimeStamp 'c', GetKey('Created', 'DateCopier');
	TimeStamp 'a', GetKey('Accessed', 'DateCopier');

j_c_hallgren
XY Blog Master
Posts: 5824
Joined: 02 Jan 2006 19:34
Location: So. Chatham MA/Clearwater FL
Contact:

Re: Request: set file create date from another file

Post by j_c_hallgren »

:D Thanks much to TheQwerty & Stephan!

For now, I'm using the simpler dual script method of copy/paste since I understand it...but I plan to try out the other one shortly as I have had this situation occur many times over the years.

Addendum: I put the Copy as Left-click on CTB and the Paste as Right-click on same CTB...ok, maybe not all that efficient but it still saved me LOADS of time! Thanks again!
Still spending WAY TOO much time here! But it's such a pleasure helping XY be a treasure!
(XP on laptop with touchpad and thus NO mouse!) Using latest beta vers when possible.

Post Reply