Hi Guys
I need to perform 8 different search and replace operations on filenames within a folder at the same time.
Is this possible?
John
Multiple Search and Replace
-
The-Debug-Store
- Posts: 7
- Joined: 23 Mar 2019 15:25
- Location: North Wales, UK
- Contact:
-
highend
- Posts: 15016
- Joined: 06 Feb 2011 00:33
- Location: Win Server 2022 @100%
Re: Multiple Search and Replace
Sure, but only via scripting.
One of my scripts helped you out? Please donate via Paypal
-
RalphM
- Posts: 2143
- Joined: 27 Jan 2005 23:38
- Location: Cairns, Australia
Re: Multiple Search and Replace
I could provide a very basic script if interested, which does multiple renames based on a text file with one rename declaration per line.
Ralph 
(OS: W11 26H2 Home x64 - XY: Current x64 beta - Office 2024 64-bit - Display: 1920x1080 @ 125%)
(OS: W11 26H2 Home x64 - XY: Current x64 beta - Office 2024 64-bit - Display: 1920x1080 @ 125%)
-
The-Debug-Store
- Posts: 7
- Joined: 23 Mar 2019 15:25
- Location: North Wales, UK
- Contact:
Re: Multiple Search and Replace
Hi Ralph
I would be most grateful if you could. I just dip in and out of XYPlorer occasionally when I need it so its a learning curve whenever I need to try something new.
John
I would be most grateful if you could. I just dip in and out of XYPlorer occasionally when I need it so its a learning curve whenever I need to try something new.
John
-
highend
- Posts: 15016
- Joined: 06 Feb 2011 00:33
- Location: Win Server 2022 @100%
Re: Multiple Search and Replace
Don't you think that you should provide a bit more details which kind of search / replace operations do you need?
Are these really 1:1 related? bird -> dog, hunter -> survivor, ...
or are they maybe pattern based? <current date> -> only keep the year, etc.
Are these really 1:1 related? bird -> dog, hunter -> survivor, ...
or are they maybe pattern based? <current date> -> only keep the year, etc.
One of my scripts helped you out? Please donate via Paypal
-
The-Debug-Store
- Posts: 7
- Joined: 23 Mar 2019 15:25
- Location: North Wales, UK
- Contact:
Re: Multiple Search and Replace
Of course,
I need to perform the following operations in one pass:
-thickbox_default-12x/-front
-thickbox_default-22x/-angle
-thickbox_default-32x/-back
-thickbox_default-42x/-fusion
-thickbox_default-52x/-shuttle
-thickbox_default-62x/-clicker
-thickbox_default-72x/-breadboard
I need to perform the following operations in one pass:
-thickbox_default-12x/-front
-thickbox_default-22x/-angle
-thickbox_default-32x/-back
-thickbox_default-42x/-fusion
-thickbox_default-52x/-shuttle
-thickbox_default-62x/-clicker
-thickbox_default-72x/-breadboard
-
highend
- Posts: 15016
- Joined: 06 Feb 2011 00:33
- Location: Win Server 2022 @100%
Re: Multiple Search and Replace
Code: Select all
$find = <<<>>>
-thickbox_default-12x
-thickbox_default-22x
-thickbox_default-32x
-thickbox_default-42x
-thickbox_default-52x
-thickbox_default-62x
-thickbox_default-72x
>>>;
$replace = <<<>>>
-front
-angle
-back
-fusion
-shuttle
-clicker
-breadboard
>>>;
$itemList = listfolder(, , 1+4, <crlf>);
$pattern = replacelist($itemList, $find, $replace, <crlf>);
rename "l", $pattern, "p", $itemList, 64;
One of my scripts helped you out? Please donate via Paypal
-
The-Debug-Store
- Posts: 7
- Joined: 23 Mar 2019 15:25
- Location: North Wales, UK
- Contact:
Re: Multiple Search and Replace
Thanks, Highland. That was more complicated than I expected!
To run the script, I want to be able to select a group of files in a Window, then apply the script.
What is the best way of storing the script then applying it, once the files have been selected?
To run the script, I want to be able to select a group of files in a Window, then apply the script.
What is the best way of storing the script then applying it, once the files have been selected?
-
highend
- Posts: 15016
- Joined: 06 Feb 2011 00:33
- Location: Win Server 2022 @100%
Re: Multiple Search and Replace
Replace
The best way? Save the script as a file in XYs script folder and load it via a catalog entry, from a toolbar button or a user defined command (and assign a keyboard shortcut)
$itemList = listfolder(, , 1+4, <crlf>); with $itemList = <get SelectedItemsNames <crlf>>;The best way? Save the script as a file in XYs script folder and load it via a catalog entry, from a toolbar button or a user defined command (and assign a keyboard shortcut)
One of my scripts helped you out? Please donate via Paypal
-
RalphM
- Posts: 2143
- Joined: 27 Jan 2005 23:38
- Location: Cairns, Australia
Re: Multiple Search and Replace
highend's version is probably more refined than my script, so I leave it at that.
Ralph 
(OS: W11 26H2 Home x64 - XY: Current x64 beta - Office 2024 64-bit - Display: 1920x1080 @ 125%)
(OS: W11 26H2 Home x64 - XY: Current x64 beta - Office 2024 64-bit - Display: 1920x1080 @ 125%)
-
The-Debug-Store
- Posts: 7
- Joined: 23 Mar 2019 15:25
- Location: North Wales, UK
- Contact:
Re: Multiple Search and Replace
OK, Ralph. I appreciate the offer though. Thank you. Highlands' script is now working just fine.
XYplorer Beta Club