Page 1 of 2

Paste into Multiple Folders ?

Posted: 16 Jan 2019 20:04
by VeeGee
Good afternoon,
Recently I had to add a file to many, many folders (.nomedia file for Kodi). I created the file, select/copied it, used Search to find all my Extras folders, inside of Search Results I selected all the folders, right-click and Paste. The .nomedia file was only copied to the last selected folder and not all of them.

I also tried a smaller experiment in the file pane and not within Search Results and had the same end result.

Is it not possible to paste into multiple selected locations (w/o the use of scripting) ? or am I missing some option/method. For now, I ended up right-clicking on each folder, paste, next folder, repeat.

Re: Paste into Multiple Folders ?

Posted: 16 Jan 2019 21:30
by highend
Afaik not possible without scripting (but I may be wrong)

Re: Paste into Multiple Folders ?

Posted: 08 May 2019 16:17
by VeeGee
I revisited this today and came up with this script. Added it as a CTB and Hamburger entry and it's working perfectly. Do you have any improvements for the script that would recommend ? or good as-is ? :

Code: Select all

foreach($item, <get SelectedItemsPathNames |>) {
	$folder = gpc($item, "base");
	pasteto "$folder";
}
Since there doesn't appear to be a way to do this w/o scripting, would it be possible to move this over to Wishes and see if Don could add this as a feature request ?

Re: Paste into Multiple Folders ?

Posted: 08 May 2019 16:26
by admin
If more than one folder is selected in the file list and then you paste via context menu or just by Ctrl+V then I think it would be okay to copy the clipboard (copy only, not cut) contents to all of those folders. So what you expected to work in your first post should have just worked. It would be a new feature, but IMO I should add it and it should just work (no settings or new commands necessary).

Any objections?

Re: Paste into Multiple Folders ?

Posted: 09 May 2019 16:08
by admin
Looked into it and saw complications building up. Given the rareness of this demand I think the script above is the perfect solution.

Re: Paste into Multiple Folders ?

Posted: 09 May 2019 17:06
by VeeGee
Thank you for taking the time to look into it. The script option is working great. I'll continue to use this method.

Re: Paste into Multiple Folders ?

Posted: 07 Feb 2022 05:56
by jerryzak
Well, I often have similar need to copy the same file into multiple folders.

I tried the script method and I am encountering rather surprising problem:
the script runs as intended BUT the file is copied ONLY up to 17 times.

If I select a large number destination folders, only the first several folders (typically anywhere between 14 to 17) will get it.

Then I see the stripped white-and-blue "Non-completed Background Jobs" icon turning.
If I click on it, I get a nice list with many entries, all similar to this:

Loading Copy "<source path goes here>\.filename.1.txt", target: "<destination path goes here>\<destination folder>" Parallel. Initiated: 2/6/2022 10:44:05 PM

But the Jobs never finish...

Any suggestions how to fix this?

Re: Paste into Multiple Folders ?

Posted: 07 Feb 2022 08:54
by admin
That's indeed a surprising problem. Can anyone confirm? (I have no time ATM)

Re: Paste into Multiple Folders ?

Posted: 07 Feb 2022 13:14
by autocart
A simple quick test with 21 folders revealed no problems here.

EDIT:
Well, I just noticed a different problem:
When I have (1) Queue file operations off and (2) Custom Copy on and (3) also Create log file on
then some copy processes say of the log file that they can't write to it because it is used by another process.
Seems understandable when thinking about it, but one will mostly only think about it when he/she sees the error message. ;)

Re: Paste into Multiple Folders ?

Posted: 07 Feb 2022 13:41
by autocart
I take that first "no problems found" report back.

At first it seemed fine because I did not pay attention to the status bar.
All copied files also show up in all target folders.
However, now I just realized that the status bar (and the background jobs list dialog) reports, as it seems, a few "hanging" copy processes.
The task manager confirms that, although task manager shows more such ones than the background jobs dialog.

Re: Paste into Multiple Folders ?

Posted: 07 Feb 2022 14:19
by admin
Tested it now with 20 targets: works well in foreground and background, but it's recommended that you turn off "Show progress dialog" and "Keep progress dialog open" in Configuration | File Operations | File Operations | Custom Copy Operations | Configure...

Re: Paste into Multiple Folders ?

Posted: 07 Feb 2022 22:38
by jupe
@jerryzak: I haven't time to test this, and not sure if it will suit your use-case but maybe if you adjust the script to force foreground ops so that the queue doesn't get used, and they are processed sequentially, would be one way to mitigate it, something like this:

Code: Select all

  setting "BackgroundFileOps", 0;
  foreach($fol, formatlist(<get selecteditemspathnamesslashed |>, "f",, "*\")) { pasteto $fol; }

Re: Paste into Multiple Folders ?

Posted: 07 Feb 2022 22:42
by autocart
jupe wrote: 07 Feb 2022 22:38 ... so that the queue doesn't get used, and they are processed sequentially ...
Is not the queue exactly meant to process threads sequentially (opposed to parallel)?
So, you probably mean so that the queue is forced to be used?

Re: Paste into Multiple Folders ?

Posted: 07 Feb 2022 22:56
by jupe
Well the issue as described (I haven't tested) seems to be ghost entries in the queue, so what I meant was that the whole sequence will complete, not get stuck in the sequence of updating the queue entries status's.

Re: Paste into Multiple Folders ?

Posted: 07 Feb 2022 22:59
by autocart
ah, foreground instead of (queued or unqueued) background processing. Now I get it. Thanks for elaborating further. :tup:

EDIT: Yes, I think it helps. Based on my very simple test.