#python 2.6
#this is test.to get current directory files
import os
import glob
mydir=os.getcwd() #check current directory
print "this is current directory: " +mydir
#inquiry whether change directory
mydirAnswer=raw_input("would you want to change directory?? n/y: ") #beloew python 3.0,function is raw_input;above python 3.0,function is input.
print mydirAnswer
mydirAnswer=mydirAnswer.lower() #all change to lower-case
if mydirAnswer=='y':
mydir=raw_input("please input your full direcorty: ")
print "you input directory is : "+ mydir
elif mydirAnswer=='n':
print "you input directory is : "+ mydir
#change directory is over
os.chdir(mydir) #change directory
print "this is your working directory: "+ os.getcwd()
for name in glob.glob('*.tps'):
print name #topcon file name rule:xxxxmmdds.tps
sitename=name[0:4]# get site name
mm=name[4:6]
dd=name[6:8]
s=name[8:9]
#deal every file name string
#assembing dos command
strdos='teqc -top tps +obs '+sitename+'.11o +nav'+' '+sitename+'.11n,'+sitename+'.11g'+' '+name
print strdos
os.popen(strdos)
raw_input("press
没有评论:
发表评论