I am brand new python user and looking for help. Need python scripts which does copy and version up (rename) the existed file. I tried to create scripts for version up, but it just adds 001 + 1 = 2 instead of v002. Also i am looking for first split the file name and then reassemble after doing math of version number. I am looking forward to someone who really can help on this. Does anyone can create and show me simple code which does above mentioned? Thanks in advance.
import os
import shutil
filename = 'New_Text_v001.txt'
fileparts = filename.split('.')
filesegments = fileparts[0].split('_')
fileVersion = filesegments[-1]
thirdSeg = fileVersion[1:5]
versionNum = int(thirdSeg) + 1
print filesegments, raw_input(versionNum), fileparts[1]