Finished section on case sensitivity.
1 parent a465e67 commit c52ca2de12d05b03a012b76c4f8be67fab9a5607
@tundra tundra authored on 29 Mar 2010
Showing 1 changed file
View
92
tren.rst
renaming over existing file- and directory names, thereby
losing the original file- or directory.
 
 
-C Do case-sensitive renaming
-C Do case sensitive renaming
 
(*Default*: This is the program default)
 
This option is provided so you can toggle the program back to
 
There are three command line options that can give you some
measure of help and information about using **tren**:
 
-d Dumps debug information out to stderr. You can
insert multiple instances of this option on the
command line to see how the program has parsed
everything *to the left* of it. This is primarily
intended as a debugging tool for people maintaining
**tren** but it does provide considerable information
on the internal state of the program that advanced
users may find useful.
 
-h Prints a summary of the program invocation syntax
and all the available options and then exits.
-d Dumps debug information out to stderr. You can insert multiple
instances of this option on the command line to see how the
program has parsed everything *to the left* of it. This is
primarily intended as a debugging tool for people maintaining
**tren** but it does provide considerable information on the
internal state of the program that advanced users may find
useful.
 
-h Prints a summary of the program invocation syntax and all the
available options and then exits.
 
-v Prints the program version number and keeps running.
 
 
 
-q Set's "quiet" mode and suppresses everthing except
error messages.
 
-w # Tells **tren** to wrap lines after ``#`` characters have been
-w # Tells **tren** to wrap lines after ``#`` characters have been
printed. If you're capturing output to a log, set this to a
very high number like 999 to inhibit line wrapping.
 
Error and debug messages are sent to ``stderr``. Normal informational
 
# tren Command Line
# Converts '.jpeg' (in any case mixture) file name suffix to '.jpg'
 
# Make the replacement case-insensitive
# Make the replacement case insensitive
-c # Reset this later on the command line with -C
 
# Only replace the rightmost instance
-i -1
file. If you find it useful, you can even include other include
files *in* an include file::
 
# Get the jpeg -> jpg suffix renaming
-I jpeg-to-jpg.tren
 
-I jpeg-to-jpg.tren
 
# Let's make it fancy
 
-i -1 -r .jpg=.fancy.jpg
 
mv file dir
 
However, this is an ``mv`` "move" semantic, and is not
properly a renaming operation. The underling file system
properly a renaming operation. The underlying file system
will not permit a file to be renamed over a directory or
vice versa. **tren** reflects this OS semantic ... it's
not intended to be a reimplementation of ``mv``.
vice versa. **tren** reflects this OS semantic ... it's not
intended to be a reimplementation of ``mv``.
 
 
Ignoring Case
=============
 
 
 
"Literal" string substitution means just that - **tren** must find an
exact instance of ``old`` in the file name being renamed and replace
it with ``new``. So, the default is to do *case sensitive* matching.
There are times, however, when you want to ignore case when doing this
matching. For example, suppose you have file names with a variety of
suffixes in various case combinations like ``.jpeg``, ``.Jpeg``, and
``.JPEG``. Suppose you'd like these to all be changed to ``.jpg``.
Rather than having to do three separate renaming operations it's handy
to just ignore case *when matching the old string for replacement*.
That's what the ``-c`` option is for::
 
tren.py -i -1 -c -r.jpeg=.jpg *.jpeg *.Jpeg *.JPEG
 
Notice that the case-insensitivity only applies to the *matching* of
the ``old`` string. Once **tren** has determined such a match exists,
the ``new`` string is used *literally* with case intact.
 
You can turn case sensitivity on- and off for various renaming
requests on the same command line. ``-C`` turns case sensitivity on,
and - as we just saw - ``-c`` turns it off::
 
tren.py -cr X=y -Cr A=b ...
 
The ``X=y`` renaming request will be done in a case insensitive
manner, whereas the ``A=b`` will be done only on literal instances of
upper case ``A`` in the target file names.
 
 
The Strange Case Of Mac OS X And Windows
========================================
-----------------------------
 
::
 
$Id: tren.rst,v 1.157 2010/03/29 15:49:55 tundra Exp $
$Id: tren.rst,v 1.158 2010/03/29 16:15:00 tundra Exp $
 
You can find the latest version of this program at:
 
http://www.tundraware.com/Software/tren