Need help with complicated renaming please

A swapping-ground for Regular Expression syntax

Re: Need help with complicated renaming please

Postby bru » Fri Feb 07, 2020 6:35 pm

Hi trm2. Sorry I didnt see your post till now.
Yes, after typing all those JoLii1,JoLii2,JoLii3,etc, I omitted .docx in the last example but cant edit it, lol.

By preview I just mean brc's "would be renamed to ________" at the command prompt.
Its not much of a preview, so I clean it up with sed (highly recommended)
For an actual in-batch preview before renaming, you could:

brc64 /WhatEver (without /Execute)
echo. If you're happy with above results, press any key to continue
pause>nul
brc64 /WhatEver /Execute

I steer clear of posting it, because those unfamiliar with batches could be a keystroke away from disaster.
You could resolve it by mandating they enter something like "1234" so anything else GoTo's an exit command.

I'm trying to duplicate your not-renaming issue, but still cant get it to fail.
Assuming: No System/Hidded/ReadOnly-files (/InclS/InclH,/InclR) & that H:\BRC_Unicode_64\brc64.exe is correct?
Also assumimg that /Execute was added back into batch after the preview-run?
Can you please confirm?

So far I've tried brc32/64 (v1.3.3.0) with varying filenames, currently on Win8.1-64bit.
Thanks.
bru
 
Posts: 62
Joined: Wed Jan 31, 2018 7:35 pm

Re: Need help with complicated renaming please

Postby trm2 » Sat Feb 08, 2020 5:00 am

Thank you for responding. Give me till next week to respond - I am working on something (unrelated) that I think EVERYONE will
be happy with - announcement coming VERY soon!! If not sooner!!
trm2
 
Posts: 156
Joined: Wed Jan 15, 2020 12:47 pm

Re: Need help with complicated renaming please

Postby trm2 » Sat Feb 08, 2020 12:49 pm

Yes, it is here. Get your FREE 300 plus pages of Bulk Rename Utility Operations manual Volume I (Volume II coming soon).

Find it in the How-To section Today! For those who have trouble using the program, need help with a feature, have questions about RegEX
(although this is covered more in the second volume, there is a RegEX manual in the appendix), want a refresher or perhaps discover new
things, It is a complete step-by-step fully photo illustrated How To.

And while you read it, remember to 'support the development of BRU' by purchasing an inexpensive commercial license today. You don't have to be
in business to reap the benefits of using it. It has JavaScript - and even if you don't know it - it can be fun to learn. I am no expert, but even I am
starting to get the hang of some of it. And if you do need expert advice, besides the many websites, books and other materials out there, the JavaScript
section of the forums can help with a very abled Admin at its helm. And Volume II will cover many examples of using it - not step by step perhaps but by
studying the code as I did, you can 'get' it.

But even if you don't have a need or want to learn JavaScript, remember that a lot of companies ask you to register their product and pay a fee. This
is no different. So if you like the program - buy the program as they say.

Enough said :)

Learn and Enjoy.
trm2
 
Posts: 156
Joined: Wed Jan 15, 2020 12:47 pm

Re: Need help with complicated renaming please

Postby trm2 » Mon Feb 10, 2020 3:01 pm

Hi Bru,

Here is the batch file:

rem @echo off
cd "h:\A Test folder"
set reg1=/Regexp:"^([A-Z]{2,})-([A-Z][^A-Z -]*?)([A-Z].*)$:\1|\2 \3"
set reg2=/Regexp:"^(.*[|][^-]*)-([A-Z][^A-Z -]*?)([A-Z].*)$:\1, \2 \3"
set max10=%reg2% %reg2% %reg2% %reg2% %reg2% %reg2% %reg2% %reg2% %reg2%
set reg3=/Regexp:"(.*[|].*), (.*):\1 and \2"
set reg4=/Regexp:"(.*)[|](.*):\1 - \2"
H:\BRC_Unicode_64\brc64.exe /Pattern:*-*.docx %reg1% %max10% %reg3% %reg4% /Execute
pause>nul


Running BRC64 as admin has removed the error.
No there are not any attributes set for either the directory or the files - they are the same test directories I use in researching.

Here is the output - it does run but it is not renaming the files:


D:\Tim\Documents>rem @echo off

D:\Tim\Documents>cd "h:\A Test folder"

D:\Tim\Documents>set reg1=/Regexp:"^([A-Z]{2,})-([A-Z][^A-Z -]*?)([A-Z].*)$:\1|\2 \3"

D:\Tim\Documents>set reg2=/Regexp:"^(.*[|][^-]*)-([A-Z][^A-Z -]*?)([A-Z].*)$:\1, \2 \3"

D:\Tim\Documents>set max10=/Regexp:"^(.*[|][^-]*)-([A-Z][^A-Z -]*?)([A-Z].*)$:\1, \2 \3" /Regexp:"^(.*[|][^-]*)-([A-Z][^A-Z -]*?)([A-Z].*)$:\1, \2 \3" /Regexp:"^(.*[|][^-]*)-([A-Z][^A-Z -]*?)([A-Z].*)$:\1, \2 \3" /Regexp:"^(.*[|][^-]*)-([A-Z][^A-Z -]*?)([A-Z].*)$:\1, \2 \3" /Regexp:"^(.*[|][^-]*)-([A-Z][^A-Z -]*?)([A-Z].*)$:\1, \2 \3" /Regexp:"^(.*[|][^-]*)-([A-Z][^A-Z -]*?)([A-Z].*)$:\1, \2 \3" /Regexp:"^(.*[|][^-]*)-([A-Z][^A-Z -]*?)([A-Z].*)$:\1, \2 \3" /Regexp:"^(.*[|][^-]*)-([A-Z][^A-Z -]*?)([A-Z].*)$:\1, \2 \3" /Regexp:"^(.*[|][^-]*)-([A-Z][^A-Z -]*?)([A-Z].*)$:\1, \2 \3"

D:\Tim\Documents>set reg3=/Regexp:"(.*[|].*), (.*):\1 and \2"

D:\Tim\Documents>set reg4=/Regexp:"(.*)[|](.*):\1 - \2"

D:\Tim\Documents>H:\BRC_Unicode_64\brc64.exe /Pattern:*-*.docx /Regexp:"^([A-Z]{2,})-([A-Z][^A-Z -]*?)([A-Z].*)$:\1|\2 \3" /Regexp:"^(.*[|][^-]*)-([A-Z][^A-Z -]*?)([A-Z].*)$:\1, \2 \3" /Regexp:"^(.*[|][^-]*)-([A-Z][^A-Z -]*?)([A-Z].*)$:\1, \2 \3" /Regexp:"^(.*[|][^-]*)-([A-Z][^A-Z -]*?)([A-Z].*)$:\1, \2 \3" /Regexp:"^(.*[|][^-]*)-([A-Z][^A-Z -]*?)([A-Z].*)$:\1, \2 \3" /Regexp:"^(.*[|][^-]*)-([A-Z][^A-Z -]*?)([A-Z].*)$:\1, \2 \3" /Regexp:"^(.*[|][^-]*)-([A-Z][^A-Z -]*?)([A-Z].*)$:\1, \2 \3" /Regexp:"^(.*[|][^-]*)-([A-Z][^A-Z -]*?)([A-Z].*)$:\1, \2 \3" /Regexp:"^(.*[|][^-]*)-([A-Z][^A-Z -]*?)([A-Z].*)$:\1, \2 \3" /Regexp:"^(.*[|][^-]*)-([A-Z][^A-Z -]*?)([A-Z].*)$:\1, \2 \3" /Regexp:"(.*[|].*), (.*):\1 and \2" /Regexp:"(.*)[|](.*):\1 - \2" /Execute

D:\Tim\Documents>pause1>nul


File samples before are:

CAN - FirstLast.docx
CAN-First Last.docx
CAN-FirstLast.docx
UK-JoLii1-JoLii2-JoLii3-JoLii4-JoLii5-JoLii6.docx

File samples after:

No change.

Conclusion - it is running and now without problems BUT the renaming itself is not working for me.

Would appreciate your further assistance. Thank you.
trm2
 
Posts: 156
Joined: Wed Jan 15, 2020 12:47 pm

Re: Need help with complicated renaming please

Postby bru » Tue Feb 11, 2020 6:34 pm

Thanks for the detailed batch-output.
Since you're running the it from another drive, you will need cd/d "H:\A Test folder"
I almost posted it earlier, but at the time you were running it from the H\: drive... Never gave it a 2nd thought.

Unfortunately, there's no way you could know this from another drive (blame Microsoft for that one).
The cd-command only reports an error if FolderPath doesnt exist, not when it fails to change-directory!

Its good practice to always use cd/d anyway, it never causes an error (blame me for that one).
Dont know how familiar you are with BRC, but you could just use brc64 /Dir:"H:\A Test folder" instead.
Either way gets you into the right folder for processing.

I'm sure you've noticed, but just in case....
I often use Regex1 as a 'file-matcher' by inserting a pipe-char, requiring subsequent regexes to match it for further processing.
That ensures that nothing in my regex-chain touches anything that Regex1 didnt match.
Sometimes, if Regex2 succeeds, I have it add another pipe, making Regex3 match ||, and so on down the chain.
Thats the beauty of BRC, all of your numbering/replacing/etc happens in the order you specify.

Hope changing directories was the only issue, if there's anything else I can do to help, please dont hesitate to ask.
I pretty good at understanding things, just not so great at explaining them.
Thanks again for the manual !!
bru
 
Posts: 62
Joined: Wed Jan 31, 2018 7:35 pm

Re: Need help with complicated renaming please

Postby trm2 » Wed Feb 12, 2020 2:24 am

Thanks for the info on cd/d It has been awhile since my batch days.

unfortunately not even this worked. What I did next was to remove all references to a drive and run the samples, the BRC and the dll from
a single directory to simplify the batch using:

rem @echo off
set reg1=/Regexp:"^([A-Z]{2,})-([A-Z][^A-Z -]*?)([A-Z].*)$:\1|\2 \3"
set reg2=/Regexp:"^(.*[|][^-]*)-([A-Z][^A-Z -]*?)([A-Z].*)$:\1, \2 \3"
set max10=%reg2% %reg2% %reg2% %reg2% %reg2% %reg2% %reg2% %reg2% %reg2%
set reg3=/Regexp:"(.*[|].*), (.*):\1 and \2"
set reg4=/Regexp:"(.*)[|](.*):\1 - \2"
brc64.exe /Pattern:*-*.docx %reg1% %max10% %reg3% %reg4%
pause>nul


Same results - it looks like the RegEx ran but no renaming.

------------------------------------
H:\BRC_Unicode_64>rem @echo off

H:\BRC_Unicode_64>rem cd/d "h:\A Test folder"

H:\BRC_Unicode_64>set reg1=/Regexp:"^([A-Z]{2,})-([A-Z][^A-Z -]*?)([A-Z].*)$:\1|\2 \3"

H:\BRC_Unicode_64>set reg2=/Regexp:"^(.*[|][^-]*)-([A-Z][^A-Z -]*?)([A-Z].*)$:\1, \2 \3"

H:\BRC_Unicode_64>set max10=/Regexp:"^(.*[|][^-]*)-([A-Z][^A-Z -]*?)([A-Z].*)$:\1, \2 \3" /Regexp:"^(.*[|][^-]*)-([A-Z][^A-Z -]*?)([A-Z].*)$:\1, \2 \3" /Regexp:"^(.*[|][^-]*)-([A-Z][^A-Z -]*?)([A-Z].*)$:\1, \2 \3" /Regexp:"^(.*[|][^-]*)-([A-Z][^A-Z -]*?)([A-Z].*)$:\1, \2 \3" /Regexp:"^(.*[|][^-]*)-([A-Z][^A-Z -]*?)([A-Z].*)$:\1, \2 \3" /Regexp:"^(.*[|][^-]*)-([A-Z][^A-Z -]*?)([A-Z].*)$:\1, \2 \3" /Regexp:"^(.*[|][^-]*)-([A-Z][^A-Z -]*?)([A-Z].*)$:\1, \2 \3" /Regexp:"^(.*[|][^-]*)-([A-Z][^A-Z -]*?)([A-Z].*)$:\1, \2 \3" /Regexp:"^(.*[|][^-]*)-([A-Z][^A-Z -]*?)([A-Z].*)$:\1, \2 \3"

H:\BRC_Unicode_64>set reg3=/Regexp:"(.*[|].*), (.*):\1 and \2"

H:\BRC_Unicode_64>set reg4=/Regexp:"(.*)[|](.*):\1 - \2"

H:\BRC_Unicode_64>brc64.exe /Pattern:*-*.docx /Regexp:"^([A-Z]{2,})-([A-Z][^A-Z -]*?)([A-Z].*)$:\1|\2 \3" /Regexp:"^(.*[|][^-]*)-([A-Z][^A-Z -]*?)([A-Z].*)$:\1, \2 \3" /Regexp:"^(.*[|][^-]*)-([A-Z][^A-Z -]*?)([A-Z].*)$:\1, \2 \3" /Regexp:"^(.*[|][^-]*)-([A-Z][^A-Z -]*?)([A-Z].*)$:\1, \2 \3" /Regexp:"^(.*[|][^-]*)-([A-Z][^A-Z -]*?)([A-Z].*)$:\1, \2 \3" /Regexp:"^(.*[|][^-]*)-([A-Z][^A-Z -]*?)([A-Z].*)$:\1, \2 \3" /Regexp:"^(.*[|][^-]*)-([A-Z][^A-Z -]*?)([A-Z].*)$:\1, \2 \3" /Regexp:"^(.*[|][^-]*)-([A-Z][^A-Z -]*?)([A-Z].*)$:\1, \2 \3" /Regexp:"^(.*[|][^-]*)-([A-Z][^A-Z -]*?)([A-Z].*)$:\1, \2 \3" /Regexp:"^(.*[|][^-]*)-([A-Z][^A-Z -]*?)([A-Z].*)$:\1, \2 \3" /Regexp:"(.*[|].*), (.*):\1 and \2" /Regexp:"(.*)[|](.*):\1 - \2"

H:\BRC_Unicode_64>pause1>nul

-------------------------------

Perhaps you could simplify the code so that it could be determined where the problem would be? I am not familiar with BRC although I am a quick learner when I put my mind to it, but I am just trying
to get it to work so it can be included within the same examples that are already part of the Volume. If we ever do get it working I would appreciate an analysis of each of the RegEx used since I can't follow your
steps too well - I have tried to do some analysis. I I have also found it impossible to try them individually in BRU - I have tried. I don't have the time to work them all out right now especially when I have the source
(yourself) available.

I do understand that BRC is running the multiple RegEx in order, but I need to see each RegEx analyzed separately so I can follow what it is doing and then I can format it in. Otherwise it is just ''here is the Brc equivalent'.
Since you employ several different techniques, I think it is important to isolate and discuss them with the readers. By the way this would be the first BRC example, since the volume is not about BRC, although the way you utilize it
fascinates me. For myself, there is very little source material in using BRC even the forums are lacking. I have thought about it possibly in the future.

But I am getting way ahead of myself. I have to get this working, FIRST.

One thing I can't understand is why I get that error even now unless I run BRC with admin rights. Running with elevated privileges should not be an issue - the directories accessed have no security or other permission problems. It is
strange. I would blame it on the 1903 Upgrade - bastards finally got me yesterday - I held off and held off (was running 1803) because when I upgraded previously from 1803 - I think it was 1809, it messed up my system pretty bad (even lost VSS) that I reverted back. But now they got me. With 1903 I had sound problems and File manager popping up every few minutes - every time I reboot now or start the computer in the morning, I wonder if it is coming back. Anyway.. I can't blame this on that because I was having the problem prior to the upgrade obviously.

Still stumped. Tried it on my wife's computer - same thing. So if we could simplify it and take it one REgEx at a time and test it against the samples - maybe that would provide the answer. Even using the BRU for the
initial testing. Have to obviously do it in several runs as opposed to a single BRC file. But I think adapting it might be the next step and then putting it back together in the batch - I don't know - it is working for you
so it must be something on my end - but what?

Tim M.
trm2
 
Posts: 156
Joined: Wed Jan 15, 2020 12:47 pm

Re: Need help with complicated renaming please

Postby trm2 » Wed Feb 12, 2020 2:58 am

I shouldn't say I don't understand it - Here is what I understand what the BRC batch file is doing without a full analysis
of each individual RegEx:

--------------

%1%
^([A-Z]{2,})-([A-Z][^A-Z -]*?)([A-Z].*)$

Replace: \1|\2 \3


%2%
^(.*[|][^-]*)-([A-Z][^A-Z -]*?)([A-Z].*)$

Replace: \1, \2 \3


%Max%
set max10=%reg2% %reg2% %reg2% %reg2% %reg2% %reg2% %reg2% %reg2% %reg2%


%3%
(.*[|].*), (.*)

Replace: \1 and \2"


%4%
(.*)[|](.*)

Replace: \1 - \2


brc64.exe /Pattern:*-*.docx Search for pattern *dash*.docx
%reg1% %max10% %reg3% %reg4% Run RegEx in order - #1, Max, #3, #4


#2 is run as part of Max10 and each #2 represents a match for a Run-On Name - up to 10 of them
I understand what Max is doing but not understand how it is implemented - it is calling another Regex to run.. but it doesn't use a Replace string like the others
which I can understand given the nature of what max does.

so the Set is setting each RegEx into an Environmental variable and then recalling them in the BRC statement.

---------------------------------
That is my understanding.

Tim M
trm2
 
Posts: 156
Joined: Wed Jan 15, 2020 12:47 pm

Re: Need help with complicated renaming please

Postby bru » Wed Feb 12, 2020 6:39 am

In the posted batch, there's no cd-command or brc's /Dir: switch to change directory.
So BRC would only see files within its own directory (H:\BRC_Unicode_64)
If your .docx files are in there, the problem could be something else.

Even with no files matched, BRC outputs: Processing Folder H:\BRC_Unicode_64\
The only way to turn that off would be using the /Quiet switch.
To troubleshoot, use this:

@echo off
cd/d "H:\PathTo.docxFiles\"
set reg1=/Regexp:"^([A-Z]{2,})-([A-Z][^A-Z -]*?)([A-Z].*)$:\1|\2 \3"
set reg2=/Regexp:"^(.*[|][^-]*)-([A-Z][^A-Z -]*?)([A-Z].*)$:\1, \2 \3"
set max10=%reg2% %reg2% %reg2% %reg2% %reg2% %reg2% %reg2% %reg2% %reg2%
set reg3=/Regexp:"(.*[|].*), (.*):\1 and \2"
set reg4=/Regexp:"(.*)[|](.*):\1 - \2"
echo.CurrentWorkingDir is "%cd%"
"PathToBRC64" /Pattern:*-*.docx
:: brc64 /Pattern:*-*.docx %reg1% %max10% %reg3% %reg4%
pause>nul

Leaving the echo off, you should see:

CurrentWorkingDir is "H:\PathTo.docxFiles\"
Processing Folder PathTo.docxFiles
Filename AAA - AnyText.docx requires no changes
Filename AAA-Any Texxt.docx requires no changes
(etc, for any .docx files)

If you dont see: "Processing Folder", brc is not launching.
Thats definitely step1, from there you could just add the %regs% back in.
I have a few others ideas, but lets confirm brc actually runs before going any further.
bru
 
Posts: 62
Joined: Wed Jan 31, 2018 7:35 pm

Re: Need help with complicated renaming please

Postby trm2 » Wed Feb 12, 2020 12:43 pm

This is not a full reply to your last inquiry BUT... (4am - so bear with me)

1. I tried your changes and effect - it did say processing (although it was hard to catch because the UAC made it flash momentarily
so I needed to run it several times to see it). Also it was processing the correct directory and verified BRC was running.

2. However - I saw the same error message that I had seen using without admin and now seeing again using BRC64 with admin.
application has requested .. unusual way
3. That got me to thinking - perhaps the fault is not in our stars but in ourselves. -

4. I started taking apart the batch file simplifying it down - still nothing. I have a file manager I use Ztree that allows me to execute
without using a command prompt. So I ran it in its basic form -- BRC64 /Changecase:U (had to read the help to get the syntax)
same result - why?

5. Next logical conclusion - there is something wrong with the library since BRC seems to be running - is it not finding the library?
concluded that wasn't the answer.

6. Corrupted library? Ran the 32 version again - same thing.

7. Went back to original zip files and extracted and compared bytes - no difference.

8. Deleted all files and extracted and ran BRC64 /Changecase:U
Ran - and now I can see what the difference between running with and without /Execute does - I can see the preview

9. Making progress.

10. Ran a few more tests from Ztree executable without batch file - still OK

11. Ran batch file with simple form - still Ok

12. Started adding in the code one by one with out the pattern - still ok

13. Added back test files.

13. Added pattern - fail

14. ran simple form again - fail. Corruption??

15. re-extracted from zip and tested from Ztree - fine once more..
.
.
anyway to cut that long story short (5am now yawn).. here is the problem -

In creating Volume 2 I have all sorts of files in test directories that I just stuck in there and rename to match the samples that I
am testing for each example (a long grueling process) but anyway, I looked at the sample files internally (Ztree has a view facility - great program) and
I had used the same file for each sample.

It was an XML file export from the index I was working on for volume 1 - now on the back burner because every time I added changes that changed
the count of the document I had to change the entire TOC and every page reference in the book to reflect the new page count - but the index- ?
well that had to be done over from scratch - that is why the current edition has no index)

again I regress ( I live in a state of constant half-asleep) …

I deleted the xml files and used different files instead and - It Ran! -
I put back your code - and it Ran - although not conclusively - I still need to address those issues in the next post. But It RAN!

Is it XML BRC doesn't like - and what does it care if it is XML or not - it is not reading the source file but yet it must be... because the
file was changed to CAN - FirstLast.docx...

Tried a different xml file - no problem.

Tried again the exported file xml - not only did it not run - it somehow corrupts either BRC executable or the Dll - not sure which because
no matter what I tested afterwards I get that error...

Okay so I determined that it wasn't corruption - I did this by replacing the current files with fresh copies of the dll and BRC individually,
testing each - same error.

Finally I removed the xml file in question and ran - this time OK .. Now you have to understand this was after I edited the batch file to
no longer consider the file in pattern..

Final Conclusion - (6:30 am)

BRC is scanning the files and when it scans the xml file in question - I don't know why but instead of just scanning the file looking for
an extension - it is reading the file internally - that is the only explanation - it has to be. Remove the files - no problem, Add the files problem.
Now why would an xml file be a problem?

I can view the file fine and I can see the xml content, but when I try to edit it with any editor - it won't load - error... interesting. So that
backs up what I was saying- BRC is not just scanning looking at the extensions - it is reading the files internally - something that BRU
doesn't do because if it did, I would have noticed a problem long before now, having used those same XML files in MANY renames.

Phew!

Okay.. Now the next post will concern your specific RegEx. Give me a little bit of time - either today or tomorrow.
trm2
 
Posts: 156
Joined: Wed Jan 15, 2020 12:47 pm

Re: Need help with complicated renaming please

Postby bru » Wed Feb 12, 2020 5:24 pm

No rush whatsover. You sound like me, hope you're getting some decent sleep.
I'm abit tired as well.. Are you saying that an .xml holds a list of filenames to be processed?
If so, BRC wont read file-contents, but Ztree could read it & pass the file-list to other apps.

Sorry I'm not familiar with ZTree, but it definitely seems to be the root issue.
Perhaps something is going awry during the hand-off to BRC that doesnt occur with BRU?
Does ZTree demand running as admin? Just throwing guesses around, cuz I honestly have no idea.

I would definitely just run the batch by clicking on it, versus launching within ZTree.
That's assumimg ZTree hasnt modded any system settings that control how batches launch.
I'm very interested in the app if you can get batches working in ZTree as they do in cmd.exe

Hopefully, by the time you read this, some decent rest will let you nail the issue.
I'm just glad its not Win10, because I was already swearing "D****ed if I update!"
Good troubleshooting btw.. Again, no rush whatsoever on posting back.

We appreciate the time/effort you're going through to make these manuals to the benefit of others.
Thanks again!
bru
 
Posts: 62
Joined: Wed Jan 31, 2018 7:35 pm

Re: Need help with complicated renaming please

Postby trm2 » Wed Feb 12, 2020 9:53 pm

Sorry to confuse you about Ztree. No it has nothing to do with that - same results running from Explorer or command prompt.

The hand off is fine in fact the problem with the running is NOW fine!! YES! .. the xml file is weird. It is exported from the
index program and can be read in by the program - but yet every other program - text editor, word processor, etc. sees it as corrupt when
I try to load it

I was able to view inside the file via Ztree and see its contents in an ASCII dump and that is how I knew what it was and where
it originated from. Looking at the code - I find nothing unusual about it. Just a plain XML file.

In fact here is some output from a screen capture:

-----------------------------------

<entry>
<entry>
<word>archive</word>
<original>archive</original>
<title>Archive File Attribute</title>
<heading>file attributes</heading>
</entry>
<entry>
<word>ascii</word>
<original>ASCII</original>
<title>ASCII Character Chart</title>
</entry>
<entry>
<word>checkmark</word>
<original>checkmark</original>
<title>Checkmark (User Interface - Include This Section in Renumber Equation)</title> </entry>
<entry>
<word>content</word>
<original>content</original>
<title>Content Pane</title>
</entry>
<entry>
<word>display</word>
<original>display</original>
<title>Display Options Henu</title>
</entry>
<entry>
<word>drag</word>
<original>drag</original>
<title>Drag and Drop from Explorer</title>
</entry>
<entry>
<word>file attributes</word>
<original>file attributes</original>
<title>File Attributes</title>
<children>
<child>file (attributes</child>
</children>
</entry>
<entry>
<word>hidden</word>
<original>hidden</original>
<title>Hidden File Attribute</title>
<heading>file attributes</heading>
</entry>

-----------------------------------

Looking at the hex dump, however provides a clue:

----------------------

00000000 3C 3F 78 6D 6C 20 76 65 72 73 69 6F 6E 3D 22 31 <?xml version="l
00000010 2E 30 22 20 65 6E 63 6F 64 69 6E 67 3D 22 55 54 .0" encoding="UT
00000020 46 2D 38 22 20 73 74 61 6E 64 61 6C 6F 6E 65 3D F-8" standalone=
00000030 22 6E 6F 22 3F 3E 0D 0A 3C 69 6E 64 65 78 67 65 "no"?>?s<indexge
00000040 6E 65 72 61 74 6F 72 3E 0D 0A 20 20 20 20 3C 65 nerator>?s <e
00000050 6E 74 72 79 3E 0D 0A 20 20 20 20 20 20 20 20 3C ntry>?s <
00000060 77 6F 72 64 3E 61 72 63 68 69 76 65 3C 2F 77 6F word>archive</wo
00000070 72 64 3E 0D 0A 20 20 20 20 20 20 20 20 3C 6F 72 rd>?s <or
00000080 69 67 69 6E 61 6C 3E 61 72 63 68 69 76 65 3C 2F iginal>archive</
00000090 6F 72 69 67 69 6E 61 6C 3E 0D 0A 20 20 20 20 20 original>?s
000000A0 20 20 20 3C 74 69 74 6C 65 3E 41 72 63 68 69 76 <title>Archiv
000000B0 65 20 46 69 6C 65 20 41 74 74 72 69 62 75 74 65 e File Attribute
000000C0 3C 2F 74 69 74 6C 65 3E 0D 0A 20 20 20 20 20 20 </title>?s
000000D0 20 20 3C 68 65 61 64 69 6E 67 3E 66 69 6C 65 20 <heading>file
000000E0 61 74 74 72 69 62 75 74 65 73 3C 2F 68 65 61 64 attributes</head
000000F0 69 6E 67 3E 0D 0A 20 20 20 20 3C 2F 65 6E 74 72 ing>?s </entr
00000100 79 3E 0D 0A 20 20 20 20 3C 65 6E 74 72 79 3E 0D y>?s <entry>J>
00000110 0A 20 20 20 20 20 20 20 20 3C 77 6F 72 64 3E 61 s <word>a
00000120 73 63 69 69 3C 2F 77 6F 72 64 3E 0D 0A 20 20 20 scii</word>?s
00000130 20 20 20 20 20 3C 6F 72 69 67 69 6E 61 6C 3E 41 <original>A
00000140 53 43 49 49 3C 2F 6F 72 69 67 69 6E 61 6C 3E 0D SCII</original>J’
00000150 0A 20 20 20 20 20 20 20 20 3C 74 69 74 6C 65 3E s <title>

--------------------
See the ?s ? that is I think the problem. It shows up as high ASCII in the viewer and that is not normal. It is not a virus or anything but I think the export of the file is
proprietary and not just a normal XML file.

I was using this file extensively in my testing - when I needed a bunch of files, I would copy this file along with many others over
to the testing directories, where I would rename them to match the samples for testing in BRU - no problem. BRU doesn't read the internals - just the extension.
So corrupt or not BRU doesn't care.. but for some reason BRC must read the files internally and encountered the corruption. Coincidentally, all of the samples
I used for the BRC were using this same exact file (copied over several times and renamed). Just happened to be those. However given what I know now, I don't
think it mattered if there was one or more than one -when BRC scanned it, error generated.

error - The Program terminated in an unusual ..

And that is the crux of it. The BRC is working now.. I ran yours real quick this morning after the exhaustive research into the problem
and it RAN - however although some filenames were going to be renamed properly, some
were not - and that is where I have to find the time to write to you about that.

But it is working.

As for Ztree - excellent file manager - can't say enough good about it - sort of like BRU in a way - not its functionality but the fact is
that it has so much functionality it would take a book to write and no I am not offering :)

In answer to your question, as for Ztree, yes it can handle batch files, can create batch files, can run programs directly or indirectly, can graft directories, mirror, great for
people like myself who have problems moving around mice all day because it can use keyboard for all of its commands as well as mouse if you prefer.
It comes from the DOS days Xtree in that time period, so it has the DOS look of which I originate from in my now going over 60 years. It has dual views,
I mean really the only thing that comes close is Directory Opus. It also has albeit limited rename ability and THAT is where I came to find BRU many eons ago hehe.
I needed more and BRU offers that and a lot more when it comes to renaming. I also still use Explorer because sometimes some things are easier to do with one
than the other but 99% of the time I use Ztree. It is a tool and requires a lot of learning. Has a very good help system but like a lot of programs, it can be as
simple or as complex as you want to make it.

BTW - it is not freeware but not expensive either. I don't think I'm allowed to post links (except to other forum areas), but look up ZTreeWin and you will easily find it.

What confused you is when I was talking abut running BRC directly from Ztree's command processor.. Sorry about that. It runs fine whether Ztree, Explorer or the Command Prompt
at least now.

Good luck on when they hit you with that Windows update.. it ain't pretty. At least 1903 went smoother than 1809, but that's not saying much. Currently another problem
is that I have to make sure one of my external drives is unplugged before turning the machine on even it was shutdown and not restarted otherwise it locks up
(this would normally be a drive or USB issue but one day apart? - the drive is not even plugged into a hub, it is direct to the computer) and That
wasn't happening before. ON the plus side, it seems to shut down faster (shutdown not reboot or restart - that is about the same). Well I was up all night so I never
shut the machine down - tonight though I will - keep your fingers crossed.

It's funny, I was racing against time because 'it' wanted to do that update and I was, at that time, rushing to get the book finalized for TGRMN and I just kept thinking that I
am going to lose the system before I can get the book finished. Talk about pressure. I got it to TGRMN just in the nick of time.

Tim M.
trm2
 
Posts: 156
Joined: Wed Jan 15, 2020 12:47 pm

Re: Need help with complicated renaming please

Postby bru » Thu Feb 13, 2020 11:43 am

Glad to hear it, sounds like you just needed some decent rest to figure it out.
Had a feeling you were talking about ZTreeWin (googled-it).. Sounds like an app I just might have to try.

In regards to the .xml file, the only thing I can figure is that:
Maybe BRC was originally written to read an .xml settings-file, much like BRU's .ini settings-file ??
And that maybe this idea was abandoned, but the code was left in ??

I tried created some 'corrupt' .xml's to duplicate, but it'd probably have to be a specific filename.
Come to think of it, wonder what BRU would do with a corrupt .ini setting-file ?? (ignored it)
Again, just throwing possibilities out there.. Guess troubleshooting's in the blood.

If you're in touch with the author, prehaps he could shed some light onto it.
I'd love a way to make BRC always use "/InclH /InclS /InclR"! Anyway, glad to hear its up & running now.
If I think of anything else, I'll post it here.
bru
 
Posts: 62
Joined: Wed Jan 31, 2018 7:35 pm

Re: Need help with complicated renaming please

Postby bru » Thu Feb 13, 2020 12:14 pm

Some other ideas (spin-offs of the last one): a rename-pairs-file, char-translation-file, etc.
bru
 
Posts: 62
Joined: Wed Jan 31, 2018 7:35 pm

Re: Need help with complicated renaming please

Postby trm2 » Thu Feb 13, 2020 7:55 pm

Now I finally have a moment to address the RegEx -

Here is what it does:

Processing Folder H:\A Test Folder\
'Filename CAN - FirstLast.docx requires no changes
Filename CAN-First Last.docx requires no changes
Filename CAN-FirstLast.docx renamed to CAN - First Last.docx
Filename UK-JoLiil-JoLii2-JoLii3-JoLii4-JoLii5-JoLii6.docx renamed to UK - Jo Liil, Jo Lii2, Jo Lii3, Jo Lii4, Jo Lii5 a nd Jo Lii6.docx

You see - it is correctly ignoring the CAN-First Last.docx, BUT it is also ignoring CAN - FirstLast.docx and it shouldn't

Please look into this.

Thanks.

Tim M.
trm2
 
Posts: 156
Joined: Wed Jan 15, 2020 12:47 pm

Re: Need help with complicated renaming please

Postby trm2 » Thu Feb 13, 2020 9:04 pm

The Admin is closer to the programmer than I am. I deal with management not programming. I do, however, submit my
requests through them. Probably if you leave your requests in the BRC forum or in the Suggestions forum, I'm sure you will get a response.

Ztree is a great program. I recommend that you try it out. If you need help there is also a great forum there as well (haven't been there
myself as of late, too busy here hehe.
trm2
 
Posts: 156
Joined: Wed Jan 15, 2020 12:47 pm

PreviousNext

Return to Regular Expressions