Processing Files, Housekeeping, Sorting and Renaming

Categories: Tools
Tags: No Tags
Comments: No Comments
Published on: August 23, 2009

You might notice already that the subject of organizing, sorting and cataloging files is one of my favorites. I am collecting and archiving a lot of stuff for personal reasons, so I have to spent a lot of time dealing with issues related to that. Since I am not an egoist and keep what I learn to myself, I am sharing what I learned with anybody who is interested in it or looks for options when he has to deal with exactly the same problems that I had. Why reinvent the wheel, right?

I would like to introduce you to a tool that I learned to appreciate a lot over the time. I am so happy that I found it and still have not discovered all the featured that this tool has to offer. It’s name does not do it justice and only describes the basic and main purpose of it.

This post has 2 parts. The first part is an introduction of the tool and the highlighting of some of its features. The second part has suggestions for the tool authors, problems that I found and a work-around for each of those problems that you might find helpful, if you happen to have the same problem that I had as well. You can jump directly to the second part of this post via THIS LINK: Jump to the Suggestions.

Bulk Rename Utility by Jim Willsher

It is called “Bulk Rename Utility” (available at BulkRenameUtility.co.uk) and was written by Jim Willsher from the United Kingdom. People are trying to sell tools for $15 to $50 that offer only a fraction of the features that BRU has in store and cost a lot less than all of those, a lot less. It is free, which is hard to beat by any means. However, donations are appreciated. I donated $20 myself, because I think that it is a great tool, which made my life a lot easier. Although I actually did donate money, what most cheap ass people out there would not do, ever, I am feeling guilty a little bit, because I know that the value of the tool for me is much higher than lousy $20.

There are 32bit and 64bit versions of the tool available for download at their web site.

The tool has so many features that it is almost impossible to explain them all. It definitely goes beyond the scope of my blog posts, which says quite a bit, considering the average length of my posts hehe.

I will highlight a few. As I said, I have not discovered all that the tool has to offer myself. I just found out during the background research for this post that there is also a command line version of BRU, which I downloaded of course and will check out later. The tool also has an excellent documentation and also a build-in help, which beats many commercial tools in quality as well. Then there is also the support forums, which has hundreds of threads, where you might be able to find answers to your questions or ask a question yourself, if you could not find what you need.

The tool supports “Regular Expressions”, which by itself makes it already very powerful. But RegEx is not simple, even with the excellent documentation and easy to understand examples that are provided in the tools documentation. That’s why there are many pre-configured options, which make the tool look confusing, if you are using it for the first time. But that is only at first glance.

BRU-Options BRU has Various Extended Options
BRU allows the customization of several behaviors of the tool and change of the layout. Options that are not enabled by default, which I suggest to enable after you installed the tool:
  1. Enable “Logical Sorting” (sort 1,2,10 instead of 1,10,2)
  2. Enable “Group Affected Files“, which makes it easier to verify the results before hand, if not all files or folders are affected by the selected renaming rules.
  3. Enable “Prevent Duplicates“. If the renaming of two files would result in the same file name, “_2″ is added to the second file or “_3″ etc., if a file with that alternative name already exists as well.

It looks confusing, because of the many options of the tool that are configurable directly from its main dash board. The dashboard is segmented into numbered blocks. Each block represents a specific type of renaming tasks that users usually want to perform. Putting each of them in a separate screen is probably not a possible alternative solution for this “overload” problem, because you can utilize the options from multiple “blocks” at the same time. One option could be to hide the detailed options of any block, which is not active and only show the ones that were selected/are active. I don’t know. Maybe it would be worth a try.

There is a simple rule, ignore all “blocks” where the font color of the title of the block is black instead of the “active” color, which can be configured via the Options menu. The default color is “red’, so if it isn’t red, don’t worry about it, because it does not do anything yet.

BRU-FixCase-FoldorFiles-Title

Here is a screen shot of a very simple, but common renaming task that you might want to perform. Although file names in NTFS (Windows) are not case-sensitive, proper cases do help visually and simply look more clean than file or folder names ALL UPPER-CASE or lower-case.

Block 4. “Case” provides options to change what the block title already suggests, the “case” of names. You can change names to all upper or lower case of course, or use the more eye friendly option of changing the case to either “Title” or “Sentence”. The “Title” option does not produce a capitalization that conforms to the rules of the English language, if you expected that. I actually wrote once a well received article that explains those rules.

It simply means that the first letter of EVERY word in the file name is changed to upper-case, versus “Sentence”, where only the first letter of the first word of the file name is changed to upper case and everything else to lower-case of course.

BRU-MoveFilesSubFold-DirPre

One feature that I discovered pretty late and wished to have found out earlier is the ability of BRU to move or copy files in bulk as well. I sometimes have the case, where I have many files in tons of sub directories, where I would like to move all of those files to a flat single directory instead.

I used to use a tool called XXCOPY in the past, which did this specific job, but it was cumbersome to use, because it requires several command-line options to be used to get the desired effect. Getting them wrong could also cause results that you did not intend. A mess that might be hard to get out of, which is a good time to mention that BRU has the ability to “revert” or “undo” the previous rename execution, if you made a mistake in the rules and realized your mistake after you executed the renaming already.

But BRU also has an option that XXCopy does not have, which is great. You can add the name of the sub-folder(s) where the file is located to the file name that you want to move as well. You can make it a prefix or suffix and specify the character that you would like to use to separate the folder name(s) from the original file name. You can include just the immediate parent folder name or the parent of the parent and the parent etc. There is no limit of levels that you can append. This is really useful, if you have a file with the same name in tons of descriptive sub folders and want to move all of them to a single and flat folder.

BRU Windows Explorer Extension
The option to add Bulk Rename Utility as custom extension to the folder context menu in Windows Explorer comes in very handy, increasing the usability of the tool 100 times fold, because the selected folder will also be selected by BRU by default.
BRU-ExplorerFolderExtension

Bulk Rename Utility has an Import Option as well, which lets you provide a text file with old name/new name pairs, separated by “|” to be processed by BRU. Why would you want to use BRU instead of renaming the files already when you create the input file itself?

Well, that is not always possible, because of permissions that might be missing, requiring a different user account to actually do the renaming. Furthermore, one thing I did not mention before, which is also important IMO. Bulk Rename Utility is FAST, really fast. How don’t know how they do it, but it beats every alternative option that I tried so far, including command line options from Windows itself or a custom VBScript or Batch script that I wrote myself or downloaded from the Internet.

Those were just a few features and options of Bulk Rename Utility. There are a lot more. There is something for extracting ID3 tag and ExIf meta data from MP3 and image files, but I have not figured out how that works exactly.?? This is also the only option that I found so far, where the documentation is a little bit too short and not sufficient to explain how to make use of this feature. I enabled it and looked at MP3 files with BRU and no obvious change was visible to me in the interface. They might want to include some practical examples for how to make use of those meta data extraction features.

I suggest to download the tool and play with it yourself to find out all the other nice things that you can do with it.?? As I mentioned already, this tool is free. No, not a free trial or a limited free edition to up-sell people to the fully functional “PRO” version. All features are enabled and there is no limitation in use or time of use of the program. This said, I also would like to repeat, that donations are appreciated by the author. It’s a great time saving tool and worth giving the author some money in return for his efforts to create this tool for you and me.

Suggestions for BRU

I signed up at the support forums for BRU, but it requires an admin to enable my account manually first, before I am able to post to their forum for suggestions. Since I hate to wait, I decided to include those suggestions in my post and then refer to it from the forum, once I have the permission to post there.

I also included a work-around for each issue that I found, so none of the problems of BRU that I found so far could not be solved by using BRU itself as well.

Replace Accented Characters

BRU Option Block 5 (Remove) / Checkbox “Accents”

This option replaces French, German accented characters with English ones in the name of the selected files and/or folders. This is a nice and good option, but a little bit flawed when it deals with the special German characters (see grid below).

List of Special German Language Characters

Character DOS ASCII

ISO 8859-1

HTML Named HTML Chr
?? 132 228 ä ä
?? 148 252 ü ü
?? 129 246 ö
?? 142?? 196 Ä Ž
?? 153 214 Ö Ö
?? 154 220 Ü Ü
?? 225 223 ß ß

????????????
The accented German letters based on the English letters oau or OAU should be replaced with oe, ae, ue, Oe, Ae and Oe (2 characters). That is the official way of converting those German characters to Latin.

The Szett character “??” is not considered by BRU at all, although it is also not an accented character. It is also called “sharp s” or “ess-zed”. However, it is also not replaced or removed via the other options, e.g. Symbol and High ASCII character removals.

Correct would be the replacement with “ss”, no upper-case version, because the letter Szett can by definition NEVER be the first character in a word, ever.

Work-Around:

A work-around to this incorrect handling of special German characters would be by using the Character Translation (CTRL-F6) feature of BRU instead of the option Block 5 (Remove) / Checkbox “Accents“. There is only one problem with this work-around though. The feature does not save the settings nor provides any option to save and load them as needed. Adding this option does make a lot sense to me.

The Character Translation feature uses ISO/IEC 8859-1 ASCII character codes and not DOS, which took me a moment to find out :). You can also use the characters itself, but does not work for special characters for example. There you must use the ASCII code instead. The translation works straight forward. One translation per line. Each translation is a pair of “old character(s)” and “new character(s)”, separated by “=”. Individual characters on each side of the “=” are separated by comma (,).

Here are the settings for the accurate replacement of special German characters with English ones.

228=a,e
252=u,e
246=o,e
196=A,e
214=O,e
220=U,e
223=s,s

Change Case to “Title” Type/Style

The “Title”-Type “Case” change works pretty well, although it could also be improved by adding some additional smart logic. When I cleaned up my MP3 collection, I noticed that abbreviations like “DJ” or “MC” are changed to “Dj” or “Mc”. Okay, it does not do it, if the proper punctuation would be used, e.g. “D.J.” or “M.C.”, but who is doing that actually?

The rules in those cases would be:

If word = “DJ” (beginning or end of string or preceded and followed by punctuation characters), leave it upper-case. Same logic for MC.

On the other hand, McDonald is changed to Mcdonald. The rule would be, if word starts with Mc, followed by an upper-case Letter (A-Z), leave it. Those rules could be enabled or disabled via a configuration option, to be flexible. Those rules apply to the English language and might not somewhere else.

Fixing incorrect Case via Character Translation

Again, the Character Translation feature can be used as a work-around/fix for the mentioned problems.

D,j,032=D,J,032
032,M,c,032=032,M,C,032

This fixes any instances of Dj followed by a SPACE/BLANK character, changing it to “DJ”+SPACE. If another character than SPACE is following the word “DJ”, the translation would have to be modified. If you use the under score “_” character instead of the SPACE for example, replace the instances of “032” with “_” and use that translation instead. Similar logic is used to fix the misspelled “Mc”, with the exception that it also requires a leading SPACE also. I added that as safeguard, because “MC” is (almost) never used at the beginning of the name (except for MC Hammer, which just came to my mind while I was writing this hehe).

In the case of McDonald etc. To fix the incorrectly renamed files/folders, use the following character translation maps. There is no easy way to indicate?? “any lower-case letter” or “change to upper-case”, so I had to specify a translation for each case individually.

032,M,c,a=032,M,c,A
032,M,c,b=032,M,c,B
032,M,c,c=032,M,c,C
032,M,c,d=032,M,c,D
032,M,c,e=032,M,c,E
032,M,c,f=032,M,c,F
032,M,c,g=032,M,c,G
032,M,c,h=032,M,c,H
032,M,c,i=032,M,c,I
032,M,c,j=032,M,c,J
032,M,c,k=032,M,c,K
032,M,c,l=032,M,c,L
032,M,c,m=032,M,c,M
032,M,c,n=032,M,c,N
032,M,c,o=032,M,c,O
032,M,c,p=032,M,c,P
032,M,c,q=032,M,c,Q
032,M,c,r=032,M,c,R
032,M,c,s=032,M,c,S
032,M,c,t=032,M,c,T
032,M,c,u=032,M,c,U
032,M,c,v=032,M,c,V
032,M,c,w=032,M,c,W
032,M,c,x=032,M,c,X
032,M,c,y=032,M,c,Y
032,M,c,z=032,M,c,Z

Amiga File Names and Extensions

I dealt quite a bit with files that were originating on the Commodore Amiga computer, mainly tracker modules. The Commodore Amiga did not use file extensions as MS DOS did. It identified the type of file by examining the header of it to then enable special options and features for it. Similar to what Windows is doing nowadays (optional in Windows XP) in addition to use traditional file extensions, which unfortunately stayed with us to this day and are the cause of many problems, due to the abuse by hackers, who get unsuspected users to execute malicious code, because they thought that the executable is a document (thanks to the feature of Windows to hide file extensions for known file types).

Anyhow, something like file extensions was adopted by Amiga users to identify the type of file by including a descriptor in the file name itself. However, they typically added the descriptor as a prefix instead of a suffix, which would then be interpreted as an extension, if transferred to a PC. Tracker modules for example are often named “mod.module name” etc.

When transferred to a PC, Windows will assume that “module name” is the extension.

BRU has some options to do something with file extensions, but I did not find an easy one for this particular problem. There is a way, which involves the use of regular expressions.

Here is what you have to do:

  1. Block 1 (RegEx):??
    Match: ^([a-zA-Z0-9]{1,4})(\.)(.*)
    Replace: \3.\1
    Check Option: Include Ext. (important)
  2. Block 11 (Extension):
    Select “Remove”
  3. Select files to rename and then press “Rename

BRU-AmigaPrefixToWinExt

A new option for the Block 11 (Extensions) that would do this would be nice. What would be a good name for it? Mhh. “swap” maybe.

I hope that you find this post useful and that it was able to solve a problem that you had or might do so in the future. Let me know in the comments section of this post below. Thanks.

Cheers!

Carsten aka Roy/SAC

You might also find one of the following related blog posts helpful: