'Cloning the current item' for multiple selections

Please check the FAQ (https://www.xyplorer.com/faq.php) before posting a question...
Post Reply
kiwichick
Posts: 676
Joined: 08 Aug 2012 04:14
Location: Windows 10 Pro 22H2, 150% scaling

'Cloning the current item' for multiple selections

Post by kiwichick »

Hi there, I've come across the 'Cloning' command in the Help File which is AWESOME because I do that kind of thing heaps. But it only works on one selected item (even if multiple items are selected). How do I get it to work for multiple selections? Cheers.
Windows 10 Pro 22H2

serendipity
Posts: 3360
Joined: 07 May 2007 18:14
Location: NJ/NY

Re: 'Cloning the current item' for multiple selections

Post by serendipity »

kiwichick wrote:Hi there, I've come across the 'Cloning' command in the Help File which is AWESOME because I do that kind of thing heaps. But it only works on one selected item (even if multiple items are selected). How do I get it to work for multiple selections? Cheers.
Yes the command "new" works for one item at a time only, use foreach loop instead something like:

Code: Select all

//Clone selected items
     foreach($item, <get SelectedItemsPathNames |>){
     new(, , "$item");
     }

kiwichick
Posts: 676
Joined: 08 Aug 2012 04:14
Location: Windows 10 Pro 22H2, 150% scaling

Re: 'Cloning the current item' for multiple selections

Post by kiwichick »

Thanks heaps, serendipity!! I had managed to get a 'clone' script semi-working with a foreach loop but I had part of the 'new' command wrong. I did manage to achieve the same result I was after by using this code:

Code: Select all

copyas "*.?";


So, what is the difference between 'cloning' and 'copying' an item? Cheers.
Windows 10 Pro 22H2

Post Reply