Page 1 of 1

Script to copy files to different directories

Posted: 10 Dec 2023 10:30
by zzjean
Hello,
I have a script that a forum member wrote for me (thanks to him) that allows me to copy selected files into defined directories:

$dstFolders = <<<>>>
X:\folder_1
X:\folder_3
P:\folder_2
>>>;
setting "BackgroundFileOps", 0;
$items = get("SelectedItemsPathNames", "|");
if !($items) { status "No items selected, aborted...", "", "stop"; end 1==1; }
foreach($folder, $dstFolders, "<crlf>") {
if !(exists($folder)) { new($folder, "dir"); }
copyto $folder, $items;

I would like to improve this script to be able to choose the directories to copy the files to. I'm a complete beginner and don't know how to do it. Can anyone help me ?
Thank you so much

Re: Script to copy files to different directories

Posted: 10 Dec 2023 18:18
by highend
be able to choose the directories to copy the files to
From the folders in $dstFolders?

If yes, add that line (with same indention) after the >>>; one:

Code: Select all

$dstFolders = inputselect("Select folder(s)", $dstFolders, <crlf>, 1+2+32+16384, , 600, 500);

Re: Script to copy files to different directories

Posted: 11 Dec 2023 06:29
by zzjean
Thanks for your help. Yes, that's what I want.
But, sorry, it doesn't work

If I do :


I have this


With this :

I have :


It’s a little better !
So, could you help me a little more
Thank you

Re: Script to copy files to different directories

Posted: 11 Dec 2023 06:39
by jupe
highend wrote: 10 Dec 2023 18:18 If yes, add that line (with same indention) after the >>>; one:

Re: Script to copy files to different directories

Posted: 11 Dec 2023 06:39
by zzjean
sorry, i forgot the attachements

Re: Script to copy files to different directories

Posted: 11 Dec 2023 07:05
by RalphM
Read & follow the instructions. :whistle:

Re: Script to copy files to different directories

Posted: 11 Dec 2023 10:04
by zzjean
I don't know how I did it, but it finally works.
My life is going to be better now :D
Thank you all for your help and patience