Advanced rename for folder creation in regex broken

Post any Bulk Rename Utility support requirements here. Open to all registered users.

Advanced rename for folder creation in regex broken

Postby jarrettsorensen » Thu Nov 24, 2022 8:39 pm

Hello

I'd like to thank you for making such an incredible tool! I'm trying to use it to move my pictures into organized folders from a folder I use to backup from my phone. From researching, I've learned that I need to enable the advanced renaming option "Allow using '\' in renaming criteria for creation of new folders", however, I've found that there is a bug with it. I'll explain the situation below and provide as much detail as I can to replicate the issue, but in short, I want to move files without renaming them into folders that use the year and month from the filename

Folder with pictures:
A:/Pictures/Unorganized/Phone/

Picture filename pattern:
yyyymmdd_hhmmss.(jpg|mp4)

Renaming options enabled:
1 (regex) match & replace
13 (copy/move to location) path: A:/Pictures, "copy not move": unchecked

Regex match:
^(\d{2})(\d{2})(\d{2})(\d{2}_\d{6})$

Regex replace:
\1\2\\2-\3\\1\2\3\4

Example file rename result:
20140723_124010.jpg > 2014\14-07140140723_124010.jpg


Regex replace with extra undesired character (-) that fixes the bug:
\1\2\\2-\3\-\1\2\3\4

Example file rename result:
20140723_124010.jpg > 2014\14-07\-20140723_124010.jpg

Thank you for your attention to this issue
jarrettsorensen
 
Posts: 2
Joined: Thu Nov 24, 2022 8:08 pm

Re: Advanced rename for folder creation in regex broken

Postby therube » Mon Nov 28, 2022 8:58 pm

Confirmed.


I'll note that depending on when you add the '-', & when Advanced Options -> \, are enabled, the '-' trick may or may not display in 'New Name'.

(I didn't test to see if when it did not display, if the actual output path/name would be correct nonetheless.)


I wonder if was ever intended that one be able to create more then one folder?
Help shows both the plural & singular:
> This option can create new folders
> if you had a file called a.txt and your renaming-criteria caused the file name a.txt to become 20190801\a.txt, then a new folder 20190801\ is created and the file a.txt is moved in there
(Since 3:Replace works, have to assume that more then one folder is allowed.)


(I'll also note that this type of rename can only be done on the same volume.
So if your file is c:\xxx.txt, you cannot "rename" it to f:\ABCxxx.txt.)


3:Replace
Looks to work as expected with "double \", abc\123\xxx.txt
therube
 
Posts: 1319
Joined: Mon Jan 18, 2016 6:23 pm

Re: Advanced rename for folder creation in regex broken

Postby therube » Mon Nov 28, 2022 9:02 pm

With RegEx:, looks like you need to ESCAPE the \, which you do with an \.

So...
Code: Select all
Replace:  \1\2\\2-\3\\\1\2\3\4

Looks like it should work.
And it looks like that is needed for the 2nd directory level - not the first.

So...

\1\2\\2-\3\\\1\2\3\4\xxx\1
gives you:
2014\14-07\140140723_124010\xxx20.jpg

Look what this one gives you (which I'm not understanding), adding a \1 onto the end?
\1\2\\2-\3\\\1\2\3\4\\\1
2014\14-07\140140723_124010\140.jpg

It's like \\\1 shows it will create a directory, but then is adding a literal 1, & then picking up a 40, which I'm not understanding?
Last edited by therube on Mon Nov 28, 2022 9:15 pm, edited 1 time in total.
therube
 
Posts: 1319
Joined: Mon Jan 18, 2016 6:23 pm

Re: Advanced rename for folder creation in regex broken

Postby therube » Mon Nov 28, 2022 9:15 pm

^--- Ah, for that, v2, needs to be enabled. So it is difference between the different RegEx libraries.

In the same way, with v2 enabled, your original Regex also works.
therube
 
Posts: 1319
Joined: Mon Jan 18, 2016 6:23 pm

Re: Advanced rename for folder creation in regex broken

Postby jarrettsorensen » Thu Dec 01, 2022 8:48 pm

Thanks @therube!

I switched it to v2 and added a bunch more \ and it did in fact work!
jarrettsorensen
 
Posts: 2
Joined: Thu Nov 24, 2022 8:08 pm


Return to BRU Support