diff --git a/tren.rst b/tren.rst index 3cb7a27..0aafc1e 100644 --- a/tren.rst +++ b/tren.rst @@ -324,7 +324,86 @@ situations, there's often no direct way to use string substitutions to order the names in some coherent way. -A "template" is built from literal text and *renaming tokens*. +A "template" is built from literal text and *renaming tokens*. These +tokens are delimited by the ``/`` character. **tren** replaces these +tokens with corresponding information (see descriptions below) to +produce a final "template text". The template text is the actual +string used to either replace the existing file or directory name (or +just the "name" or "extension" portions, depending on which options +you've selected) or to be appended or prepended to the name. + +Currently, **tren** defines a number of renaming tokens. + +File Related Renaming Tokens +---------------------------- + +These tokens are derived from information about the file or +directory being renamed. + + + +``/D/ File or directory creation date`` + + This token is replaced with the date of creation + of the file or directory being renamed. It is + in ``YYYMMDD format.`` + +``/E/ Original File Extension`` + + This token is replaced the "extension" portion of the file + or directory before renaming. This does not include the + extension separator string. + +``/F/ Original File Name`` + + This token is replaced the "name" portion of the file or + directory before renaming. + +.. NOTE:: Notice that there is no token for the *whole* filename + because you can always synthesize it with ``/F/./E/`` + + +``/I/ File or directory creation date`` + + This token is replaced with the date of creation of the + file or directory being renamed. It is similar to ``/D/`` + except it is in ISO format, ``YYYY-MM-YY``. + +``/S/ File or directory *size*`` + + This token is replaced with a numeric string + that indicates the size of the file or directory + in bytes. + +``/T/ File or directory creation time`` + + This token is replaced with the time of creation + of the file or directory being renamed. It is + in ``HH:MM:SS`` format. + +``/00nn/ File time sequence, ascending`` + +``/-00nn/ File time sequence, descending`` + + +System Related Renaming Tokens +------------------------------ + +These tokens are derived from the underlying operating system +and runtime environment. + +``/$ENV/ Environment variable`` + + This token is replaced with the value of + the environment variable ``$ENV``. If + that variable does not exist, the token + is replaced with an empty string. + + +``/\cmd\`/`` Arbitrary command execution`` + + This token is replaced with the text + returned by executing the ``cmd`` command. EXAMPLES @@ -428,7 +507,7 @@ :: - $Id: tren.rst,v 1.114 2010/01/16 16:11:40 tundra Exp $ + $Id: tren.rst,v 1.115 2010/01/16 17:01:21 tundra Exp $ You can find the latest version of this program at: