import glob
import subprocess
import re
import time
import os
import sys
repo=sys.argv[1]
names= glob.glob(os.path.join(repo,'ch1*.html'))
for name in names:
    reg_obj=re.compile(os.path.join(repo,'ch1[0-9].*.html'))
    if (reg_obj.match(name)):
        changed_name=re.sub('ch1','chn1',name)
       
    else:
        changed_name=name    
    command="mv %s %s" %(name ,changed_name) 
    subprocess.Popen(command,shell=True)
    time.sleep(2)
    
