Page 1 of 1

Files' Dates and Sizes Quick Comparison.

Posted: 05 Dec 2010 13:24
by SkyFrontier
This one will just check for files on both panes, ignoring folder calculations.
It's a quick solution to fast compare one file on each panes against size, modification and creation dates.
If more than one file is selected in one of the panes it'll just compare and display their sizes in both "flexible" and "bytes" modes.
Suggested KS: SHIFT+Y.

Code: Select all

   end (<xyver> < "9.70.0007"), "Sorry - this script requires XYplorer version 9.70.0007 or higher.<crlf>Click 'Ok' to exit.";
    if (get("#800") == "0") {
        #800;
    }
   $pa = "<get pane>";

   $count = getinfo("CountSelected");
   $counti = getinfo("CountSelected", "i");
   IF ($count > 1) { sub "_MORE" }
   IF ($counti > 1) { sub "_MORE" }

//Makes no sense since it has "_MORE"; otherwise, enable it to get it working with more than one file
//but be aware: it'll display respective dates on reports, too...
//   end(getinfo("CountSelected") > 1), "No more than one file must be selected on current pane.";
//   end(getinfo("CountSelected", "i") > 1), "No more than one file must be selected on opposite pane.";

   end(getinfo("CountSelected") < 1), "At least one file must be selected on current pane.";
   end(getinfo("CountSelected", "i") < 1), "At least one file must be selected on opposite pane.";

   $a= report ("{Size RAW}+", 1); $t= $a; replace $t, $t, "-","0"; $t= eval ($t);
   $res = formatbytes($t, "BB", -1);
   $dc= report ("{created}", 1);
   $dm= report ("{modified}", 1);
   focus pi;
   $pi = "<get pane i>";
   $b= report ("{Size RAW}+", 1); $t2= $b; replace $t2, $t2, "-","0"; $t2= eval ($t2);
   $res2 = formatbytes($t2, "BB", -1);
   $dc2= report ("{created}", 1);
   $dm2= report ("{modified}", 1);
   focus pi;
   $f = formatbytes($res, "flex", -1);
   $f2 = formatbytes($res2, "flex", -1);
   msg "Sizes are " . ("$res" Like "$res2"?:"***NOT***") . " identical!<crlf>Modified dates are " . ("$dm" Like "$dm2"?:"***NOT***") . " identical!<crlf>Created dates are " . ("$dc" Like "$dc2"?:"***NOT***") . " identical!<crlf>File sizes on pane $pa are: $res,<crlf>  while in the pane $pi are $res2.<crlf>Flexible values:<crlf>$f, $dm (DM) and $dc (DC) on pane $pa,<crlf>$f2, $dm2 (DM) and $dc2 (DC) on pane $pi.<crlf><crlf>Please click 'OK' to copy this message on clipboard<crlf>or 'cancel' to simply shut it.<crlf><crlf>-Have a nice day!", 1, ;
   copytext "Sizes are " . ("$res" Like "$res2"?:"***NOT***") . " identical!<crlf>Modified dates are " . ("$dm" Like "$dm2"?:"***NOT***") . " identical!<crlf>Created dates are " . ("$dc" Like "$dc2"?:"***NOT***") . " identical!<crlf>File sizes on pane $pa are: $res,<crlf>  while in the pane $pi are $res2.<crlf>Flexible values:<crlf>$f, $dm (DM) and $dc (DC) on pane $pa,<crlf>$f2, $dm2 (DM) and $dc2 (DC) on pane $pi.<crlf><crlf>Please click 'OK' to copy this message on clipboard<crlf>or 'cancel' to simply shut it.<crlf><crlf>-Have a nice day!";

"_MORE"

   end (<xyver> < "9.70.0007"), "Sorry - this script requires XYplorer version 9.70.0007 or higher.<crlf>Click 'Ok' to exit.";
    if (get("#800") == "0") {
        #800;
    }
   $pa = "<get pane>";
   end(getinfo("CountSelected") < 1), "At least one file must be selected on current pane.";
   end(getinfo("CountSelected", "i") < 1), "At least one file must be selected on opposite pane.";
   $a= report ("{Size RAW}+", 1); $t= $a; replace $t, $t, "-","0"; $t= eval ($t);
   $res = formatbytes($t, "BB", -1);
   focus pi;
   $pi = "<get pane i>";
   $b= report ("{Size RAW}+", 1); $t2= $b; replace $t2, $t2, "-","0"; $t2= eval ($t2);
   $res2 = formatbytes($t2, "BB", -1);
   focus pi;
   $f = formatbytes($res, "flex", -1);
   $f2 = formatbytes($res2, "flex", -1);
   msg "Sizes are " . ("$res" Like "$res2"?:"***NOT***") . " identical!<crlf>File sizes on pane $pa are: $res,<crlf>  while in the pane $pi are $res2.<crlf>Flexible values:<crlf>$f on pane $pa,<crlf>$f2 on pane $pi.<crlf><crlf>Please click 'OK' to copy this message on clipboard<crlf>or 'cancel' to simply shut it.<crlf><crlf>-Have a nice day!", 1, ;
   copytext "Sizes are " . ("$res" Like "$res2"?:"***NOT***") . " identical!<crlf>File sizes on pane $pa are: $res,<crlf>  while in the pane $pi are $res2.<crlf>Flexible values:<crlf>$f on pane $pa,<crlf>$f2 on pane $pi.<crlf><crlf>Please click 'OK' to copy this message on clipboard<crlf>or 'cancel' to simply shut it.<crlf><crlf>-Have a nice day!";
   end 1;

Re: Files' Dates and Sizes Quick Comparison.

Posted: 05 Dec 2010 14:04
by admin
Tip: This will fail as soon as we have reached v10:

Code: Select all

end (<xyver> < "9.70.0007")
Look at the compare command with method parameter "v"...

Re: Files' Dates and Sizes Quick Comparison.

Posted: 05 Dec 2010 14:12
by SkyFrontier
admin wrote:Tip: This will fail as soon as we have reached v10:

Code: Select all

end (<xyver> < "9.70.0007")
Look at the compare command with method parameter "v"...
:|
Well... there's just one way for learning... :roll:
Thanks for the tip, Don! I'll revise my version checking method anytime soon and silently update other posted scripts that use current one.