Page 1 of 1

Simple (Non-Looping, Intrinsic) Rename

Posted: 22 Mar 2022 08:58
by MediaManny
I feel like a complete idiot. I've wasted two hours experimenting with different techniques to rename files by script.

All of the examples on the forum appear to use loops, which I don't think is required in this instance -- and yet I just can't find a solution.

I'm forced to do this in a script because I need to execute over 100k+ files. Because XYplorer doesn't allow selecting a folder and recursively renaming below this, I would have to select all files -- which essentially times-out/locks-up due to the large number of files.

I thought I could do something simple, like:

Code: Select all

$files = <get SelectedItemsPathNames>;
rename r, "\W*(remove1|remove2|remove3)\W* > ", $files;
(to make it easier to understand, I've altered regex to be very simple/straightforward)

I'd just like to drop a folder on my .xys script and have it apply a Regex rename across all files recursively below that folder.

Is my belief wrong; is this not something that can be done in two lines without looping?

Thank you in advance!

Re: Simple (Non-Looping, Intrinsic) Rename

Posted: 22 Mar 2022 09:32
by highend
Ofc this can be done without looping. But not without getting all the files to be renamed^^

Code: Select all

rename "r", "(\W*(?:remove1|remove2|remove3)\W*) > ", , quicksearch("/f", <get drop>, , "s");

Re: Simple (Non-Looping, Intrinsic) Rename

Posted: 23 Mar 2022 03:48
by MediaManny
highend wrote: 22 Mar 2022 09:32 Ofc this can be done without looping. But not without getting all the files to be renamed^^
Thank you, that's very helpful.

As explained in the original post, the need to use a script is due to there being far too many images to be able to select them all. It brings XYplorer to a crawl.

I thought I might be able to modify your quicksearch example to do what I needed. Unfortunately, the quicksearch() topic in the help-file does not mention either the "/f" or "s" params -- and I'm not sure what they do or whether there is a route where modification would enable my intended goal.

Thank you again for the insight.

Re: Simple (Non-Looping, Intrinsic) Rename

Posted: 23 Mar 2022 05:08
by highend
I'd just like to drop a folder on my .xys script and have it apply a Regex rename across all files recursively below that folder
That's exactly what my script line does...
Unfortunately, the quicksearch() topic in the help-file does not mention either the "/f" or "s" params
1.
1.png
2. Ofc it's not shown a second time inside the function explanation.If you would have followed the link to Quick Search you'd have seen all the available switches...
2.png
Animation.gif