This is part of a larger project Erol (Vortex) and I have been working on, tackling a number of long standing problems with Windows.
In this case it's the ongoing bugaboo about programmatic renaming of files that has been around since the good old days of MS-DOS.
After a lot of head scratching and experimenting, what we came up with was a simple system of 2 and 3 character macros that can be loaded into a wildcard string to rename files and groups of files. The macros are capable of very impressive transformations and many of the "evils" of bad filenames can be fixed quite easily.
The attached screen shot shows only a tiny fraction of their capabilities.
Be sure to unpack the Renamer2.zip file into an empty directory.
The Renamer algorithm is a single function. The source is in the lib\renlib.c file. You can copy and paste or you can include the precompiled renlib32.lib or renlib64.lib files into your project. The renamer.h file gives you the prototype which is...
BOOL RenameFile(PCHAR Old, PCHAR WCard, PCHAR New)
Pass the old filename (no paths) into the Old parameter, pass a macro string into the WCard parameter and point the New parameter at an empty buffer large enough to hold the new name. The function returns 1 on success or 0 on any error.
For instant gratification click the QuickTest.bat file. It will write a number of files into a folder named test1 and then copy/rename them into test2. Compare the results to see how handy it is.
A list of the Renamer macros is in the RenamerMacros.txt file. (Note: If you are using the earlier version, some of the macros have changed so be sure to check the list first.)
The demo32.exe and demo64.exe programs will let you test the macros and get a feel for how they work.
The Renamer32.exe and Renamer64.exe programs are "live" utilities that will let you experiment further. Rename, copy and move are supported, all using the Renamer algorithm. (Please note: this is supplied for demonstration purposes only and is not intended to be a daily use utility.)
If you study the source code for the utilities (namer.c, in the Utility folder) you will see how easily the Renamer algorithm integrates with FindFirstFile() and FindNextFile() loops, giving you the ability to easily update existing programs with Renamer's advanced capabilities.
So, there it is... a simple solution to a decades old problem.