Some slight reformatting.
1 parent 261fed5 commit 319bf60bebe3f35247b53815bd30406b002851e9
@tundra tundra authored on 14 Jan 2010
Showing 1 changed file
View
42
tren.rst
 
String Substition
-----------------
 
String substitution is handy when you have files and directories
that have a common set of characters in them you'd like to change.
For instance::
String substitution is handy when you have files and directories
that have a common set of characters in them you'd like to change.
For instance::
 
tren -r .Jpeg=.jpg files.Jpeg
tren -r .Jpeg=.jpg files.Jpeg
 
would rename all files (or directories) whose names contained the string
``.Jpeg`` and replace it with ``.jpg``. It's important to realize that
such a substitution takes place *anywhere* in the filename, not just at
the end or "extension" (as it is called in Windows).
would rename all files (or directories) whose names contained the string
``.Jpeg`` and replace it with ``.jpg``. It's important to realize that
such a substitution takes place *anywhere* in the filename, not just at
the end or "extension" (as it is called in Windows).
 
By default, only the first instance of the string is replaced in the
name, but you can use the ``-g`` option to replace *all* instances
of the old string with the new one.
By default, only the first instance of the string is replaced in the
name, but you can use the ``-g`` option to replace *all* instances
of the old string with the new one.
 
Ordinarily **tren** treats both the old string you specify with
the ``-r`` option *literally*. However, it is sometimes handy
to be able to write a regular expression to specify what you
want replaced. If you specify the ``-x`` option, **tren** will
treat your old string as a Python style regex, compile it (or
try to anyway!) and use it to select which strings to replace.
This makes it much easier to rename files that have repeated
characters or patterns, and groups of files that have similar,
but not idential strings in their names you'd like to replace.
Ordinarily **tren** treats both the old string you specify with
the ``-r`` option *literally*. However, it is sometimes handy
to be able to write a regular expression to specify what you
want replaced. If you specify the ``-x`` option, **tren** will
treat your old string as a Python style regex, compile it (or
try to anyway!) and use it to select which strings to replace.
This makes it much easier to rename files that have repeated
characters or patterns, and groups of files that have similar,
but not idential strings in their names you'd like to replace.
 
 
Rename By Date
--------------
-----------------------------
 
::
 
$Id: tren.rst,v 1.104 2010/01/15 02:15:41 tundra Exp $
$Id: tren.rst,v 1.105 2010/01/15 02:32:18 tundra Exp $
 
You can find the latest version of this program at:
 
http://www.tundraware.com/Software/tren