Automatically create folder based on file name = "folderize"

Bulk Rename Utility How-To's

Automatically create folder based on file name = "folderize"

Postby Admin » Sat May 22, 2021 10:04 am

Question from BRU user:

Does BRU have the ability to automatically create a folder based on the filename and move files into that folder?
e.g. process a London001.jpg, to create a ..\London\ and then move the file inside it to leave ..\London\London001.jpg
This would be excellent for catalog creation for people like photographers, or for people to bulk rename and move files to say ..\2021\
(that may be a 2 pass process but still easy enough, 1 for the renaming, then another for the move) etc.

Yes, absolutely.

First switch on the required option:

Advanced Options > Allow Using '\' in Renaming Criteria for Creation of New Folders (Advanced Option)

Use this option with caution. This option can create new folders during renaming and can not be undone. With this option selected, if the new resulting file name contains a \, then a new folder is created, instead of just considering the file name invalid. So for example, 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. This is called 'folderize'. Using this option, you can reorganize files into folders based on their timestamps, for instance, or name.
Before using this option it is recommended to backup your files.

So for the example above:
To put London001.jpg into London\London001.jpg

Need to match London first and add it to the file name.

We can do that with RegEx (1) = Regular Expressions

Match : (\D+)(.*)
Replace: \1\\1\2

will transform London001.jpg into London\London001.jpg

(\D+) matches characters that are not a digit (first match)
(.*) matches all the rest

Replace \1\\1\2 means <first match>\<first match><second match>

Renaming will move all files that start with London into a London subfolder.

Always backup all files before carrying on very complex renaming!
(You can use our ViceVersa PRO for that! :) -->
Site Admin
Posts: 2085
Joined: Tue Mar 08, 2005 8:39 pm

Return to How-To