Tcl
|
This Tcl script provides a procedure for adding padding to a file name. For example, given a name such as, untitled.021.1.tif it would return this name untitled.0021.1.tif The procedure assumes the numeric extension to be padded to 4 digits follows the actual name of the file and is separated by periods. For this reason the "extra" numeric extension of ".1." has not been effected. This procedure will not work with an input name that does not separate the numeric extension with a leading period, for example, untitled021.tif would be incorrectly returned as, untitled021.0tif |
The input parameters are:
padding
name the name of a file
Return value
the new file name
Example:
set oldname "untitled.021.0001.tif"
set newname [padding $oldname]
puts $newname
|
© 2002- Malcolm Kesson. All rights reserved.