Timestamp sync-ing
Timestamp sync-ing
Is there a smart way using a script to set all timestamps of all files in a folder (on a file by file basis) to the "Modified" timestamp of each file.
Why?
Many archives only store the "modilfied" timestamp and when these are unarchived the other two (created & accessed) are set to "now", which leads to the curious situation than a file is modified before it's created. Using the properties this is correctable via cut&paste, but doing so for large archives is a bit tedious.
Why?
Many archives only store the "modilfied" timestamp and when these are unarchived the other two (created & accessed) are set to "now", which leads to the curious situation than a file is modified before it's created. Using the properties this is correctable via cut&paste, but doing so for large archives is a bit tedious.
Robert AH Prins
robert.ah.prins @ the.17+Gb.Google thingy
At last, a tiny bit of programming here...
robert.ah.prins @ the.17+Gb.Google thingy
At last, a tiny bit of programming here...
Re: Timestamp sync-ing
::msg property("Write");
Use that in the address bar after selecting one of your files and tell me if it delivers the time that you want to set.
Use that in the address bar after selecting one of your files and tell me if it delivers the time that you want to set.
One of my scripts helped you out? Please donate via Paypal
Re: Timestamp sync-ing
Yes, it doeshighend wrote:::msg property("Write");
Use that in the address bar after selecting one of your files and tell me if it delivers the time that you want to set.
Robert AH Prins
robert.ah.prins @ the.17+Gb.Google thingy
At last, a tiny bit of programming here...
robert.ah.prins @ the.17+Gb.Google thingy
At last, a tiny bit of programming here...
Re: Timestamp sync-ing
EDIT: Please post a timestamp from a few of your files (I want to see which format is used on your locale)
Create a new folder, copy one of your files to this folder, jump into this folder.
Use the script.
Get the properties tab of this file and check if all times are exactly equal to the modified time of your file.
If not, change $hMod and $sMod to accommodate your time differences (hMod = +- modified hours, the same for seconds).
Repeat the process until everything is right.
If you don't want the script to set the timestamps recursively, remove the second "r" in the: line!
Use it at your own risk, too lazy to implement any checks now
I' have to modify it a bit to avoid non allowed times... Stay tuned.
[/code]
Create a new folder, copy one of your files to this folder, jump into this folder.
Use the script.
Get the properties tab of this file and check if all times are exactly equal to the modified time of your file.
If not, change $hMod and $sMod to accommodate your time differences (hMod = +- modified hours, the same for seconds).
Repeat the process until everything is right.
If you don't want the script to set the timestamps recursively, remove the second "r" in the:
Code: Select all
$files = folderreport("files", "r", , "r", , "|");Use it at your own risk, too lazy to implement any checks now
I' have to modify it a bit to avoid non allowed times... Stay tuned.
[/code]
One of my scripts helped you out? Please donate via Paypal
Re: Timestamp sync-ing
Script seems to have fallen through?
Anyway, my timestamps are of the "2012-01-20 17:38:06" format
Anyway, my timestamps are of the "2012-01-20 17:38:06" format
Robert AH Prins
robert.ah.prins @ the.17+Gb.Google thingy
At last, a tiny bit of programming here...
robert.ah.prins @ the.17+Gb.Google thingy
At last, a tiny bit of programming here...
Re: Timestamp sync-ing
No, I've removed it intentionally.Script seems to have fallen through?
Code: Select all
$hMod = "";
$sMod = "";
$files = folderreport("files", "r", , , , "|");
$string = "";
foreach($item, $files, "|") {
$mTime = property("Write", $item);
$nDate = gettoken($mTime, 1, " ");
$nTime = gettoken($mTime, 2, " ");
$nmTime = (gettoken($nTime, 1, ":") + $hMod) . ":" . gettoken($nTime, 2, ":") . ":" . gettoken($nTime, 3, ":") + $sMod;
timestamp ca, "$nDate $nmTime", $item;
$string = $string . $item . " was set to: " . "$nDate $nmTime" . <crlf>;
}
text $string;One of my scripts helped you out? Please donate via Paypal
Re: Timestamp sync-ing
It works and it doesn't work... Some timestamps are OK, but for most the created & modified times are one or two seconds more, and setting a timestamp to "23:59:59" will result in a error-box with "Invalid date: yyyy-mm-dd 0::0". Looking at the script (as a complete newbie) I cannot really see why this would be happening.
Robert AH Prins
robert.ah.prins @ the.17+Gb.Google thingy
At last, a tiny bit of programming here...
robert.ah.prins @ the.17+Gb.Google thingy
At last, a tiny bit of programming here...
Re: Timestamp sync-ing
It has nothing to do with the script itself. I have the same issues because of the 2 sec time difference.
E.g.:
The original modified time property shows: 16:05:07
but if I overwrite it with ::timestamp m, "19.04.2012 16:05:07";
the new stamp will be 16:05:09;
It's a windows "feature"...
It can be fixed but you have to do a few more tests. I must know if the time difference (seconds or hours) are always the same or if they differ (sometimes 1 second, sometimes 2 or if the hour can be two hours off as well).
If that's the case, $hMod and $sMod could be set to accommodate these changes but I have to rewrite the script to check for time boundaries (e.g. 59 seconds original, the new time must be 1 minute, 1 second (on a two second time difference)).
E.g.:
The original modified time property shows: 16:05:07
but if I overwrite it with ::timestamp m, "19.04.2012 16:05:07";
the new stamp will be 16:05:09;
It's a windows "feature"...
It can be fixed but you have to do a few more tests. I must know if the time difference (seconds or hours) are always the same or if they differ (sometimes 1 second, sometimes 2 or if the hour can be two hours off as well).
If that's the case, $hMod and $sMod could be set to accommodate these changes but I have to rewrite the script to check for time boundaries (e.g. 59 seconds original, the new time must be 1 minute, 1 second (on a two second time difference)).
One of my scripts helped you out? Please donate via Paypal
Re: Timestamp sync-ing
Explain the "windows feature^H^H^H^H^H^Hannoyance", as it doesn't occur with any other timestamp changing tools (Romain Petges "Attribute Changer", kish "PropertiesPlus", GNU's touch) and of course the properties pane in XY.
Robert AH Prins
robert.ah.prins @ the.17+Gb.Google thingy
At last, a tiny bit of programming here...
robert.ah.prins @ the.17+Gb.Google thingy
At last, a tiny bit of programming here...
Re: Timestamp sync-ing
I don't think that that Don recreated a timestamp writing feature instead of calling a windows function for it.
https://startpage.com/do/search?languag ... difference
If any of these utilities correct this issue by themselfes, fine, use them.
https://startpage.com/do/search?languag ... difference
If any of these utilities correct this issue by themselfes, fine, use them.
One of my scripts helped you out? Please donate via Paypal
Re: Timestamp sync-ing
Don's do-it-in-the properties pane (using Cut&Paste) works flawlessly, but it's just not suitable for doing it to dozens of files created from unzipping an archive.highend wrote:I don't think that that Don recreated a timestamp writing feature instead of calling a windows function for it.
https://startpage.com/do/search?languag ... difference
If any of these utilities correct this issue by themselfes, fine, use them.
And as for the utilities which don't have the seconds-off issue,
- All of them can process a whole directory, but cannot do the whole-directory processing on a file-by-file basis
- GNU's touch cannot change the creation date
- PropertiesPlus and Attribute Changer only work as GUI
- PropertiesPlus no longer works on W64
- Attribute Changer is 64-bit shell extension and as such doesn't work in XY
Robert AH Prins
robert.ah.prins @ the.17+Gb.Google thingy
At last, a tiny bit of programming here...
robert.ah.prins @ the.17+Gb.Google thingy
At last, a tiny bit of programming here...
Re: Timestamp sync-ing
Help - Advanced Topics - Scripting Commands Reference - get & run
and
Help - Advanced Topics - Scripting - Control Structures - Foreach Loops
Enough to get it running.
and
Help - Advanced Topics - Scripting - Control Structures - Foreach Loops
Enough to get it running.
One of my scripts helped you out? Please donate via Paypal
Re: Timestamp sync-ing
Thank you for the pointer, if I get stuck I'll come back.
Robert AH Prins
robert.ah.prins @ the.17+Gb.Google thingy
At last, a tiny bit of programming here...
robert.ah.prins @ the.17+Gb.Google thingy
At last, a tiny bit of programming here...
XYplorer Beta Club