[Scripting Help] Please help : Copy script

Please check the FAQ (https://www.xyplorer.com/faq.php) before posting a question...
Post Reply
nav
Posts: 20
Joined: 14 Mar 2013 21:44

[Scripting Help] Please help : Copy script

Post 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

SkyFrontier
Posts: 2341
Joined: 04 Jan 2010 14:27
Location: Pasárgada (eu vou!)

Re: [Scripting Help] Please help : Copy script

Post 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?
New User's Ref. Guide and Quick Setup Guide can help a bit! Check XYplorer Resources Index for many useful links!
Want a new XYperience? XY MOD - surfYnXoard
-coz' the aim of computing is to free us to LIVE...

nav
Posts: 20
Joined: 14 Mar 2013 21:44

Re: [Scripting Help] Please help : Copy script

Post 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 :)

SkyFrontier
Posts: 2341
Joined: 04 Jan 2010 14:27
Location: Pasárgada (eu vou!)

Re: [Scripting Help] Please help : Copy script

Post 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.
New User's Ref. Guide and Quick Setup Guide can help a bit! Check XYplorer Resources Index for many useful links!
Want a new XYperience? XY MOD - surfYnXoard
-coz' the aim of computing is to free us to LIVE...

nav
Posts: 20
Joined: 14 Mar 2013 21:44

Re: [Scripting Help] Please help : Copy script

Post 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 !!

Post Reply