Page 1 of 1

[Scripting Help] Please help : Copy script

Posted: 22 Jul 2015 07:03
by nav
For example i have some files in a folder
"E:\abc\settings\"
i want to copy these file to
"d:\abc\settings\"

(if the source folder is "e:\abcxyz\" then the target folder will be "d:\abcxyz\"

(change e:\ to d:\ and create folder if not exist)
when i select multiple files in a folder and run this script , it will copy these file to that location
i really appreciate any helps
Thanks

Re: [Scripting Help] Please help : Copy script

Posted: 23 Jul 2015 01:50
by SkyFrontier
Would it be nice for you if the script detects the FOLDER YOU'RE IN (active pane) as a whole as the source and a dialogue popped asks for the target drive? Or perhaps you want this to work only on selected items?

Re: [Scripting Help] Please help : Copy script

Posted: 23 Jul 2015 05:24
by nav
SkyFrontier wrote:Would it be nice for you if the script detects the FOLDER YOU'RE IN (active pane) as a whole as the source and a dialogue popped asks for the target drive? Or perhaps you want this to work only on selected items?
Thank you ,
i want to copy only selected items in that folder :)

Re: [Scripting Help] Please help : Copy script

Posted: 23 Jul 2015 06:07
by SkyFrontier

Code: Select all

   $a1 = get("selecteditemspathnames", "|");
   end ($a1 == ""), "Select at least one item to be copied. Please. >sigh<";
   $tst = gettoken($a1, 1, "|");
   $a = getpathcomponent($tst, "path");
   $d2 = gettoken($a, 2, ":\", , 2);
   $d1 = getpathcomponent($tst, "drive") . ":\";
   $d = get("drives", "2") . "|" . get("drives", "3");
   $d = trim($d, "|");
   $d = replace("$d", "$d1", "");
   $d = trim($d, "|");
   $d = replace("$d", "||", "|");
   $d = inputselect("Select the drive where selection will be mirrored to:", $d, "|");
   end ($d == ""), "One destination drive MUST be chosen. Please. >sigh<";

   $dest = $d . $d2;
   $cf = confirm("Selection will be copied into<crlf>$dest<crlf 2>Continue?", , 2);
   if($cf == 0) { end 1, "Operation cancelled.<crlf 2>Bye."; }
   else {  }
   copyto "$dest", "$a1";
   beep;
   echo "copy done! Au reavoir...";
See if this is what you want.

Re: [Scripting Help] Please help : Copy script

Posted: 23 Jul 2015 06:35
by nav
SkyFrontier wrote:

Code: Select all

   $a1 = get("selecteditemspathnames", "|");
   end ($a1 == ""), "Select at least one item to be copied. Please. >sigh<";
   $tst = gettoken($a1, 1, "|");
   $a = getpathcomponent($tst, "path");
   $d2 = gettoken($a, 2, ":\", , 2);
   $d1 = getpathcomponent($tst, "drive") . ":\";
   $d = get("drives", "2") . "|" . get("drives", "3");
   $d = trim($d, "|");
   $d = replace("$d", "$d1", "");
   $d = trim($d, "|");
   $d = replace("$d", "||", "|");
   $d = inputselect("Select the drive where selection will be mirrored to:", $d, "|");
   end ($d == ""), "One destination drive MUST be chosen. Please. >sigh<";

   $dest = $d . $d2;
   $cf = confirm("Selection will be copied into<crlf>$dest<crlf 2>Continue?", , 2);
   if($cf == 0) { end 1, "Operation cancelled.<crlf 2>Bye."; }
   else {  }
   copyto "$dest", "$a1";
   beep;
   echo "copy done! Au reavoir...";
See if this is what you want.
Thank you so much , it works great !!