Began documenting general attribute renaming tokens.
1 parent f0e5bf7 commit 09554951dc4e2ee348b0ab1ec8da2dde241d8850
@tundra tundra authored on 2 Apr 2010
Showing 1 changed file
View
168
tren.rst
 
General Attribute Renaming Tokens
=================================
 
 
NOTE TO WINDOWS USERS GOES HERE
 
 
These tokens are derived from information about the file or
directory being renamed.
 
 
``/DEV/ What This Is``
``/DEV/ Returns File- Or Directory's Device ID``
 
This is the ID of the device containing the file being renamed.
You might want to rename files so that all the files on a given
device start with the same key. That way, their names group
together in a directory listing::
 
tren.py -r=/DEV/-/FNAME/ file | dir, file | dir, ...
 
You end up with a directory listing that looks something like::
 
93-...
93-...
97-...
98-...
 
The filenames are still preserved in our renaming reqest above,
now they're just preceded by the device ID of the where they live
with a trailing ``-`` separator.
 
``/FNAME/ Returns Original File- Or Directory Name``
 
This is the name of the file- or directory you are
renaming *before* you apply any renaming requests. This
allows you to create new names based, in part, on the old
name::
 
tren.py -r=/FNAME/-suffix file | dir ... # Adds "-suffix" to the end of original name
tren.py -r=prefix-/FNAME/ file | dir ... # Adds "-prefix" to start of original name
tren.py -r /FNAME/=newname file | dir ... # Same as "-r=newname"
tren.py -r /FNAME/=/FNAME/ file | dir ... # Does nothing since old- and newname are the same
 
``/GID/ Returns File- Or Directory's Group ID``
 
This is the number for the group to which the file- or
directory belongs. One way to use this is to prepend it
to every file name, thereby having all files (and or
directories) in the same group sort together in a
directory listing::
 
tren.py -r=/GID/-/FNAME/ file | dir ...
 
``/GROUP/ Returns File- Or Directory's Group Name``
Essentially the same as ``/GID/`` except it returns the
*name* of the group rather than the number. Again, this
is useful when clustering names together in a directory listing::
 
tren.py -r=/GROUP/-/FNAME/ file | dir ...
 
``/INODE/ Returns File- Or Directory's``
 
Explanation
 
``/FNAME/ What This Is``
``/MODE/ Returns File- Or Directory's``
 
Explanation
 
``/GID/ What This Is``
``/NLINK/ Returns File- Or Directory's``
 
Explanation
 
``/GROUP/ What This Is``
``/SIZE/ Returns File- Or Directory's``
 
Explanation
 
``/INODE/ What This Is``
``/UID/ Returns File- Or Directory's``
 
Explanation
 
``/MODE/ What This Is``
 
Explanation
 
``/NLINK/ What This Is``
 
Explanation
 
``/SIZE/ What This Is``
 
Explanation
 
``/UID/ What This Is``
 
Explanation
 
``/USER/ What This Is``
``/USER/ Returns File- Or Directory's``
 
Explanation
 
 
time-related attribute tokens indicates which of the three timestamps
above is used to compute the value:
 
 
``/ADAY/, /CDAY/, /MDAY/ What This Is``
``/ADAY/, /CDAY/, /MDAY/ Returns File- Or Directory's``
 
Explanation
 
``/AHOUR, /CHOUR/, /MHOUR/ What This Is``
``/AHOUR, /CHOUR/, /MHOUR/ Returns File- Or Directory's``
 
Explanation
 
``/AMIN/, /CMIN/, /MMIN/ What This Is``
``/AMIN/, /CMIN/, /MMIN/ Returns File- Or Directory's``
 
Explanation
 
``/AMON/, /CMON/, /MMON/ What This Is``
``/AMON/, /CMON/, /MMON/ Returns File- Or Directory's``
 
Explanation
 
``/AMONT, /CMONTH/, /MMONTH/ What This Is``
``/AMONT, /CMONTH/, /MMONTH/ Returns File- Or Directory's``
 
Explanation
 
``/ASEC/, /CSEC/, /MSEC/ What This Is``
``/ASEC/, /CSEC/, /MSEC/ Returns File- Or Directory's``
 
Explanation
 
``/AWDAY, /CWDAY/, /MWDAY/ What This Is``
``/AWDAY, /CWDAY/, /MWDAY/ Returns File- Or Directory's``
 
Explanation
 
``/AYEAR, /CYEAR/, /MYEAR/ What This Is``
``/AYEAR, /CYEAR/, /MYEAR/ Returns File- Or Directory's``
 
Explanation
 
 
examples cover many common applications of the program.
 
- Literal String Replacement
 
- Replacing Or Removing All Instances Of A String
 
- Changing A File's "Extension" Suffix
 
- Appending- Or Prepending Strings To An Existing File Name
 
-----------------------------
 
::
 
$Id: tren.rst,v 1.170 2010/04/02 03:17:54 tundra Exp $
$Id: tren.rst,v 1.171 2010/04/02 20:29:45 tundra Exp $
 
You can find the latest version of this program at:
 
http://www.tundraware.com/Software/tren