* The script has 2 separate functions now. It can either TimeSync things recursively or not recursively.
* It can now also sync time to "Current Time" or "Oldest Date" (Thanks to Marco!)
* It can now properly time sync folders and subfolders as well.
Just thought to post it here in case someone is interested or too laze to code it. All this does is it allow you to sync the date and time of selected items to any of its other dates. It also allows syncing to current time and manual input as well. For example, you want to sync the time of its created and accessed date to its modified date. You can then simply select the files and folders (it is recursive), select the dates and time that you want to change, and then select what date and time you want it to sync to.
This script is created a while back and related to http://www.xyplorer.com/xyfc/viewtopic.php?f=7&t=8068
The version I wrote and used for a while was somewhat broken and crude. Now I fixed it and up and add a few other things for it to do.
Use it by adding the script as a toolbar, catalog item, or UDC. Then you can select the files/folders and then run the script. Simple enough.
Code: Select all
/*
TimeSync 1.0 By Enternal - December 16, 2014
http://www.xyplorer.com/
*/
Global $Files;
End ("<selitems>"==""),"Nothing Is Selected!";
$SelectedItems = Get("SelectedItemsPathNames","|");
$ToChange = InputSelect("Date(s) to Change:", "Created|Modified|Accessed", "", "10");
$SyncTo = InputSelect("Sync Date(s) To:", "Created|Modified|Accessed|Current Time|Manual", "", "8");
If $SyncTo == Manual {$Input = Input("Date & Time Input", "" , FormatDate());}
ForEach($Item, $SelectedItems, "|") {
If Exists($Item) == 2 {
$Files = $Files.FolderReport("files", "r", $Item, "r", , "|")."|"; }
ElseIf Exists($Item) == 1 {
$Files = $Files.Report("{Fullname}|", "1")."|"; } }
$Files = FormatList($Files, "tsed", "|");
ForEach($Method, $ToChange, "|") {
$ToChange = Replace($ToChange, "Created", "c");
$ToChange = Replace($ToChange, "Modified", "m");
$ToChange = Replace($ToChange, "Accessed", "a");
$ToChange = Replace($ToChange, "|", "");
ForEach($Item, $Files, "|") {
If $SyncTo == "Current Time" {
$nDate = GetToken(FormatDate(), 1, " ");
$nTime = GetToken(FormatDate(), 2, " "); }
ElseIf $SyncTo == Manual {
$nDate = GetToken($Input, 1, " ");
$nTime = GetToken($Input, 2, " "); }
Else {
$Time = Report("{$SyncTo}", $Item);
$nDate = GetToken($Time, 1, " ");
$nTime = GetToken($Time, 2, " "); }
Timestamp $ToChange, "$nDate $nTime", $Item;
}
}