rename part of a file/folder using BRU

Bulk Rename Utility How-To's

rename part of a file/folder using BRU

Postby Palm128 » Mon Jan 25, 2021 12:35 pm

I want to change a person's name from a lot of documents and folders on a drive cloud. This name can occur anywhere within the document or folder name e.g. XXX name, or name XXX. How do I use BRU to change this person's name from Name1 to Name2 within this drivecloud using BRU? Thanks
Palm128
 
Posts: 9
Joined: Mon Jan 25, 2021 12:33 pm

Re: rename part of a file/folder using BRU

Postby therube » Mon Jan 25, 2021 9:40 pm

Disregarding "folders" & disregarding "on a drive cloud", 3:Replace, could cover the renaming of file names.

With 3:Replace, you'd have to watch out for matches that while they may match, are not matching what you intended.

Like if you wanted to replace "page" with "XXX", you might have a name like "offline web page" that is OK to change to "offline web XXX",
but you might also have "his pager" where you would not want that renamed to "his XXXr".
(If that were the situation, you'd have to try an alternative means, like by using 1:RegEx.)


I don't really know about "clouds", but if the "cloud" provides an interface that is accessible to BRU then I'd think you could do that part too.
And if not, then you'd have to find something else to handle that part.
therube
 
Posts: 1317
Joined: Mon Jan 18, 2016 6:23 pm

Re: rename part of a file/folder using BRU

Postby Palm128 » Tue Jan 26, 2021 11:00 pm

The cloud appears as a drive on BRU.

The name I want to repalce only ever appears as 'Name' with no prefix, suffix, or possessive pronoun (such as 'Name's').

Would I use 1:RegEx or 3:Replace for this?

Thanks
Palm128
 
Posts: 9
Joined: Mon Jan 25, 2021 12:33 pm

Re: rename part of a file/folder using BRU

Postby Luuk » Thu Jan 28, 2021 2:36 am

Greetings Palm128, Im thinking RegEx(1) with checkmark in "v2" wins the decision. This to replace every "BAD" when its the whole word...
Match...
Code: Select all
\bBAD\b/g
Replace...
Code: Select all
GOOD
Luuk
 
Posts: 699
Joined: Fri Feb 21, 2020 10:58 pm

Re: rename part of a file/folder using BRU

Postby Palm128 » Sat Jan 30, 2021 2:50 pm

Here is a redacted JPEG snippet of my bulk rename utility:https://e.pcloud.link/publink/show?code=XZKcJkZQjVQAPL1UIfczPXpzjKSEHurv7A7

Where do I put the code to replace 'BAD' with 'GOOD'
Palm128
 
Posts: 9
Joined: Mon Jan 25, 2021 12:33 pm

Re: rename part of a file/folder using BRU

Postby Luuk » Sat Jan 30, 2021 4:32 pm

First to get v3.4.1.0 from here... https://www.bulkrenameutility.co.uk/Download.php so there can be "v2" inside the RegEx(1).
Then it conducts like the explanation. If not able to use the newest version, here is some other ways, but not as good ...

In Replace(3), the Replace/With can be BAD/GOOD
This replaces all the BADs, even when its part of a longer word (BADGE -> GOODGE)

In RegEx(1), the Match/Replace...
(^|.* )BAD( .*|$)
\1GOOD\2
This replaces BAD if its a whole word, but only replaces one BAD, so maybe keep doing if there is many BADs?
Luuk
 
Posts: 699
Joined: Fri Feb 21, 2020 10:58 pm

Re: rename part of a file/folder using BRU

Postby Luuk » Sat Jan 30, 2021 4:47 pm

This another way without having "v2" in the RegEx(1).. Its just like the "v2", except only replacing one BAD at a time ...
Match ...
Code: Select all
(.*\b)BAD(\b.*)
Replace ...
Code: Select all
\1GOOD\2
Luuk
 
Posts: 699
Joined: Fri Feb 21, 2020 10:58 pm

Re: rename part of a file/folder using BRU

Postby Palm128 » Sun Jan 31, 2021 2:24 pm

Here is a screenshot of the latest BRU with the code in RegEx(1) as:https://e.pcloud.link/publink/show?code=XZrdFkZSKOwxzWCwDLAiapz63mvChB7V2ek

Match: (^|.* )Phoebe( .*|$)
Replace: \1Pebe\2

'Phoebe' is the target name for replacement. 'Pebe' is the replacement name.

It is not working. BRU is not picking up the 100+ files that have 'Phoebe' in the filename.

What am I doing wrong?
Palm128
 
Posts: 9
Joined: Mon Jan 25, 2021 12:33 pm

Re: rename part of a file/folder using BRU

Postby Luuk » Sun Jan 31, 2021 6:14 pm

Im thinking the problem is, you cant see the "Phoebe" names because having 371219 selected files. There is "Display Option, Sorting, Group Affected Files" to put all of the "Phoebe" names on the top, but I think its better using Filters(12), and also probably the first "v2" regex ...

Regex(1) with "v2" and Match/Replace...
\bPhoebe\b/g
Pebe

Filters(12)...
*Pheobe*

The Filters(12) to show only 100+ "Phoebe" files, instead of 371219. You might also prefer the other regexs, but this can depend on your filenames.
Luuk
 
Posts: 699
Joined: Fri Feb 21, 2020 10:58 pm

Re: rename part of a file/folder using BRU

Postby Luuk » Sun Jan 31, 2021 6:25 pm

If you never use Filters(12) before... First type *Phoebe* in "Mask", then to click the blue-arrows at right.
Luuk
 
Posts: 699
Joined: Fri Feb 21, 2020 10:58 pm

Re: rename part of a file/folder using BRU

Postby Palm128 » Mon Feb 01, 2021 4:01 pm

The code as below:

Regex(1) with "v2" and Match/Replace...
Match: \bPhoebe\b/g
Replace: Pebe

Filters(12)...
*Phoebe*

Only brings up matches where word 'Phoebe' is at the start of the filename. How can the match be changed so that the word 'Phoebe' is brought up anywhere within the filename?
Palm128
 
Posts: 9
Joined: Mon Jan 25, 2021 12:33 pm

Re: rename part of a file/folder using BRU

Postby Luuk » Mon Feb 01, 2021 4:37 pm

The match conducts anywhere in the filename, so maybe you changed *Phoebe* --> Phoebe*
Luuk
 
Posts: 699
Joined: Fri Feb 21, 2020 10:58 pm

Re: rename part of a file/folder using BRU

Postby Palm128 » Mon Feb 01, 2021 9:08 pm

See screenshot:https://e.pcloud.link/publink/show?code=XZq9HkZyvcRVQe7cTjMbfWQIV2u7Y8uwkG7


The filter in the screenshot was *Phoebe*
It's picking any file with that word anywhere in the filename, but it is not suggesting a name change to 'Pebe' in the New file. Is there a reason why?
Palm128
 
Posts: 9
Joined: Mon Jan 25, 2021 12:33 pm

Re: rename part of a file/folder using BRU

Postby Luuk » Mon Feb 01, 2021 10:42 pm

Its because the screenshot presents "phoebe" instead "Phoebe" and also with underscores. So to conduct these also, the RegEx(1) with "v2" is needing...
(\b|_)[pP]hoebe(\b|_)/g
$1Pebe$2

Unless you wish Phoebe->Pebe and phoebe->pebe, then instead it should be like...
(\b|_)([pP])hoebe(\b|_)/g
$1$2ebe$3
Luuk
 
Posts: 699
Joined: Fri Feb 21, 2020 10:58 pm

Re: rename part of a file/folder using BRU

Postby Palm128 » Wed Feb 03, 2021 9:35 pm

Using the RegEx(1) with "v2".
Match: (\b|_)[pP]hoebe(\b|_)/g
Replace: $1Pebe$2
Filter (12) Mask: *Phoebe*
Result:https://e.pcloud.link/publink/show?code=XZNFLkZD0q0abI6zIfYfTUgupoAPXehYGny

Using Phoebe->Pebe and phoebe->pebe
Match: (\b|_)([pP])hoebe(\b|_)/g
Replace: $1$2ebe$3
Filter (12) Mask: *Phoebe*
Result:https://e.pcloud.link/publink/show?code=XZypLkZkwoln2D4VGRkPTvm8SGndQTS6v7k

In both cases a portion of the found files were successfully renamed - so it is part working. For the other files the error message: "the system cannot find the file specified". Why is it throwing up this error message? Please help, thanks
Palm128
 
Posts: 9
Joined: Mon Jan 25, 2021 12:33 pm

Next

Return to How-To