help with counter

Bill Carter BC at energy.com
Mon Jan 6 21:20:41 CET 2003


I must have been looking at this problem for to  long, but I need some
help because I am stuck.

I have a series of files on disk   file.01.txt, file.02.txt ...
what I am trying to do is rename all the files a new name but also not
renaming a few files but maintaining the number sequence

for example 

#sample command line
pyrename.py file.01.txt file.400.txt  3 newfile.01.txt  

# breakdown
script name / filename of first file / last filename / drop every 3rd
file / new filename and start number


should produce 

file.01.txt     	newfile.01.txt
file.02.txt	newfile.02.txt
file.03.txt	
file.04.txt	newfile.03.txt
file.05.txt	newfile.04.txt
file.06.txt	newfile.05.txt
file.07.txt	newfile.06.txt
file.08.txt	
file.09.txt	newfile.07.txt
file.10.txt ...	newfile.08.txt...

the filename changes the amount changes and the file to be dropped
changes.

For some reason I can't put my head around this problem.  Any help
would be appreciated.

BC






More information about the Python-list mailing list