Implemented File Length renaming token.
1 parent 8c4c81a commit 091d2c2e2e8109fc228d7f09b5c3274f18f63160
@tundra tundra authored on 6 Mar 2010
Showing 1 changed file
View
14
tren.py
 
PROGNAME = "tren.py"
BASENAME = PROGNAME.split(".py")[0]
PROGENV = BASENAME.upper()
RCSID = "$Id: tren.py,v 1.170 2010/03/06 01:38:28 tundra Exp $"
RCSID = "$Id: tren.py,v 1.171 2010/03/06 15:57:21 tundra Exp $"
VERSION = RCSID.split()[2]
 
# Copyright Information
 
 
TOKCMDEXEC = "`" # Delimiter for command execution renaming tokens
TOKDELIM = "/" # Delimiter for all renaming tokens
TOKENV = "$" # Introducer for environment variable replacement tokens
TOKFILLEN = "L" # File Length replacement token
TOKFILNAM = "F" # File Name replacement token
 
 
# Internal program state literals
This class is used to keep track of all the files and/or
directories we're renaming. After the class is constructed
and the command line fully parsed, this will contain:
 
self.RenNames = { fullname : {BASE : basename, PATHNAME : pathtofile, STAT : stats}
self.RenNames = { fullname : {BASE : basename, PATHNAME : pathtofile, STATS : stats}
... (repeated for each rename target)
}
 
self.SortViews = {
###
# File Attribute Renaming Tokens
###
 
if r[2] == TOKFILNAM:
if r[2] == TOKFILLEN:
r[2] = str(self.RenNames[target][STATS][ST_SIZE])
 
elif r[2] == TOKFILNAM:
r[2] = os.path.basename(target)
 
###
# System Renaming Tokens
###