diff --git a/tren.py b/tren.py index a2bff70..a96c290 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.149 2010/02/05 21:25:31 tundra Exp $" +RCSID = "$Id: tren.py,v 1.150 2010/02/05 21:35:47 tundra Exp $" VERSION = RCSID.split()[2] # Copyright Information @@ -180,8 +180,8 @@ # Informational Messages ##### -iRENEXISTING = "Forced rename existing '%s' to '%s' !" -iSKIPPING = "Skipping '%s' - Newname '%s' Exists!" +iRENEXISTING = "Forced rename of existing '%s' to '%s' !" +iSKIPPING = "Skipping rename of '%s' - Newname '%s' Exists!" ##### @@ -504,11 +504,9 @@ # Now that we have a new name, attempt the actual renaming # operation - RenamingError = False - newname = pathname + basename - # First make sure the new name meets length constraints + RenamingError = False if len(basename) < MINNAMELEN: ErrorMsg(eNAMESHORT% (target, basename, MINNAMELEN), EXIT=not ProgramOptions[ERRORCONTINUE]) RenamingError = True @@ -516,7 +514,8 @@ if len(basename) > MAXNAMELEN: ErrorMsg(eNAMELONG % (target, basename, MAXNAMELEN), EXIT=not ProgramOptions[ERRORCONTINUE]) RenamingError = True - + + newname = pathname + basename if (target != newname) and not RenamingError: # Figure out if the newname already exists @@ -524,28 +523,27 @@ newexists = False if os.path.exists(newname): newexists = True + renameexisting = newname + ProgramOptions[EXISTSUFFIX] # Just show what we would do - if ProgramOptions[TESTMODE]: if newexists: - if ProgramOptions[FORCERENAM]: - renameexisting = newname + ProgramOptions[EXISTSUFFIX] + # Forced renaming of existing targets + if ProgramOptions[FORCERENAM]: InfoMsg(iRENEXISTING % (newname, renameexisting), TESTMODE) + # Skip renaming if target already exists else: - InfoMsg(iSKIPPING % (target, newname), TESTMODE) + # Target does not exist, do the rename else: - InfoMsg(ColumnPad([target + " %s " % ARROW, newname]), TESTMODE) # Actually do the renaming else: - print target + "---->"+ newname # End of 'Rename()'