diff --git a/tren.py b/tren.py index 5f51cd1..8cf6f39 100755 --- a/tren.py +++ b/tren.py @@ -8,7 +8,7 @@ PROGNAME = "tren.py" BASENAME = PROGNAME.split(".py")[0] PROGENV = BASENAME.upper() -RCSID = "$Id: tren.py,v 1.174 2010/03/08 19:29:52 tundra Exp $" +RCSID = "$Id: tren.py,v 1.175 2010/03/08 21:02:35 tundra Exp $" VERSION = RCSID.split()[2] # Copyright Information @@ -45,6 +45,7 @@ import re from stat import * import sys +import time #----------------------------------------------------------# @@ -112,10 +113,19 @@ SINGLEINST = "SINGLEINST" # Indicates a single, not range, replacement instance + +##### +# Month Conversion Tables +##### + +MONTHS = {"Jan":"01", "Feb":"02", "Mar":"03", "Apr":"04", "May":"05", "Jun":"06", + "Jul":"07", "Aug":"08", "Sep":"09", "Oct":"10", "Nov":"11", "Dec":"12"} + ##### # Replacement Token Literals ##### +TOKCDATE = "CDATE" # Cdate replacement token TOKCMDEXEC = "`" # Delimiter for command execution renaming tokens TOKDELIM = "/" # Delimiter for all renaming tokens TOKENV = "$" # Introducer for environment variable replacement tokens @@ -748,7 +758,17 @@ # File Attribute Renaming Tokens ### - if r[2] == TOKFILGID: + if r[2] == TOKCDATE: + + t = time.ctime(self.RenNames[target][STATS][ST_CTIME]).split() + + if len(t[2]) == 1: + t[2] = "0" + t[2] + + r[2] = t[4] + MONTHS[t[1]] + t[2] + + + elif r[2] == TOKFILGID: r[2] = str(self.RenNames[target][STATS][ST_GID]) elif r[2] == TOKFILGRP: