Documented $TREN.
Described how options may be specified.
Changed -F to -I.
1 parent e026988 commit 97d4c416f706fa06f8130076b179a6d12142ec4f
@tundra tundra authored on 22 Jan 2010
Showing 1 changed file
View
106
tren.rst
--------
 
::
 
tren.py [-1abCcdEefghqtvXx] [-F file] [-l string] [-r old=new]... file|dir file|dir ...
tren.py [-1abCcdEefghqtvXx] [-I file] [-l string] [-r old=new]... file|dir file|dir ...
 
 
OPTIONS
-------
 
You may specify *tren* options in one of three ways:
 
1) On the command line
2) In an "include" file specified with ``-I filename`` on the command line
3) Via the ``$TREN`` environment variable
 
Note that options specified on the command line are evaluated from
left to right and supercede any options specified in the environment
variable. Think of any options set in ``$TREN`` as the "leftmost
command line options".
 
-1 Rename only the first instance of the specified string
 
(*Default*: This is the program default)
"extension" not on the file name portion. For example::
 
tren.py -e -r pe=p peg.jpeg # Renames file to peg.jpg
 
-F file Read command line arguments from ``file``
-f Force renaming even if target file or directory name already
exists.
 
(*Default*: Skip renaming if a file or directory already
exists by the same name as the target.)
 
-g Replace all instances (global rename) of the old string
with the new.
 
(*Default*: Only the first matching string is replaced.)
 
Ordinarily, **tren** only replaces the single *leftmost*
instance of a string in the entire filename (default), the name
portion (``-b``) or the extension (``-e``). If you want
*all* instances of a particular string replaced, use this
option to enable "global" renaming::
 
tren.py -g -r p:P pop.txp # Renames file to: PoP.txP
 
This option is ignored during regular expression processing
(``-x``).
 
-h Print help information.
 
 
-I file "Include" command line arguments from ``file``
 
It is possible to perform multiple renaming operations in one
step using more than one ``-r`` option on the **tren** command
line. However, this can make the command line very long and
hard to read. This is especially true if the renaming strings
are complex, contain regular expressions or renaming
templates, or if you make heavy use of command line toggles.
 
The ``-F`` option allows you to place any command line
The ``-I`` option allows you to place any command line
arguments in a separate *file* in place of- or in addition to
the **tren** command line itself. This file is read one line
at a time and the contents appended to any existing command
line. You can even name the files you want renamed in the
file, but they must appear as the last lines of that file
(because they must appear last on the command line).
the **tren** command line and/or the ``$TREN`` environment
variable. This file is read one line at a time and the
contents appended to any existing command line. You can even
name the files you want renamed in the file, but they must
appear as the last lines of that file (because they must appear
last on the command line).
 
Whitespace is ignored as is anything from a ``#`` to the end of
a line::
 
file.* ``*.txt`` will typically be expanded by a command
shell to create a list of files ending in ``.txt``.
However, the ``*`` metacharacter has no such meaning when
used inside an arguments file.
 
-f Force renaming even if target file or directory name already
exists.
 
(*Default*: Skip renaming if a file or directory already
exists by the same name as the target.)
 
-g Replace all instances (global rename) of the old string
with the new.
 
(*Default*: Only the first matching string is replaced.)
 
Ordinarily, **tren** only replaces the single *leftmost*
instance of a string in the entire filename (default), the name
portion (``-b``) or the extension (``-e``). If you want
*all* instances of a particular string replaced, use this
option to enable "global" renaming::
 
tren.py -g -r p:P pop.txp # Renames file to: PoP.txP
 
This option is ignored during regular expression processing
(``-x``).
 
-h Print help information.
 
 
-l string File "extension" delimiter string.
 
(*Default*: ".")
-----------------------------
 
::
 
$Id: tren.rst,v 1.133 2010/01/21 23:47:40 tundra Exp $
$Id: tren.rst,v 1.134 2010/01/22 17:46:04 tundra Exp $
 
You can find the latest version of this program at:
 
http://www.tundraware.com/Software/tren