SDLrename as Renaming Engine

Apart from the classical stand-alone solution SDLRename can be used by other programs as renaming engine. In this case the actual renaming has to be performed by the calling program, SDLRename only reports what it would have done, if it were called in the stand-alone mode.

When called by an external application SDLRename displays a slightly different user interface, omitting the top panel for the selection of files. The list of files to be renamed are passed to SDLRename by a control file. On return, SDLRename writes an outout file to the disk where it stores the new filenames along with the old ones.

This simple file based interface allows to control SDLRename and use it as a renaming engine for external applications. Whether SDLRename is functioning as a stand-alone program or as a renaming engine depends on the calling parameters. Calling it without parameters envokes the stand-alone program, otherwise the calling application has to pass one or two parameters:

sdlrename controlfile [outputfile]

The parameters contain the names of the control file and the output file. The output filename may be omitted; in this case the results of the renaming process will be written to a file whose file name is derived from the name of the control file by prepending the string "$renamed$_" to the control file name.

Format of the input control file

1st line Caption of the program (text to be displayed in the header of the SDLRename window)
any other line filedate filename
Each file to be renamed is listed in a line of its own specifying the file date and the filename. The file date has to be specified as floating point number counting the days from Dec 30, 1899, 12:00am.
Example The following example shows a list of five file names, each line starting with the file date followed by the filename:
  Title to be shown....
  39231.9239999 mysoft_spac.jpg
  39271.0239999 mysoft spac.gif
  39731.9239999 c:\temp\mysoft_spac2.jpg
  37231.9239999 maxpath\myGGsoft_spac.jpg
  38231.9239999 H:lo\lo\myasd blaasdsoft_spac.jpg

Format of the result file

1st line number of file names following, plus string "TSO" if time stamp operations are requested
2nd and following lines The new file names are stored (one per line) using the format <old name>=<new name>. Please note that always all file names are listed even those which are not going to be changed. In this case the left and the right side of the "equation" are equal. If the user clicked the cancel button the output file simply consists of a single line containing a "0" (to indicate that no files have to be renamed due to cancellation of the renaming action).
Example 1 The following example shows the stored renaming operations after closing SDLRename. Only the second and the fifth name are to be renamed (blank replaced by underscore).
  <mysoft spac.gif>=<mysoft_spac.gif>
  <h:lo\lo\myasd blaasdsoft_spac.jpg>=<h:lo\lo\myasd_blaasdsoft_spac.jpg>
Example 2 The following example shows the stored time stamp operations after closing SDLRename. Note, that the reuested time stamp operations are indicated by the string "TSO" after the number of lines.
  3 TSO
  <mysoft_spac.jpg>=<2008-12-01 22:17:01>
  <c:\temp\mysoft_spac2.jpg>=<2008-12-01 22:17:17>
  <h:lo\lo\myasd blaasdsoft_spac.jpg>=<2008-12-04 22:17:21>

Differences between engine and stand-alone solution

The differences between the renaming engine and the stand-alone program are mainly in the user interface. The engine version shows the following changes:
  • The "Refresh File List" and the "Undo" buttons are invisible
  • There is no file selection panel
  • Renaming actions cannot be repeated without closing the engine window
  • The engine window is closed automatically after pressing the "Do it" button
  • No feedback is given after the renaming action

Last Update: 2008-Sep-05