import os
import time
import shutil
today = time.strftime('%Y%m%d')
now = time.strftime('%H%M%S')
from_path = "C:\\Program Files\\COSCO\\vsagentlib"
newdir = ''.join((''.join((today,'-')),now))
to_path = "c:\\image\\"+today
if not os.path.exists(from_path):
os.mkdir(to_path) # make directory
print 'Successfully created directory', to_path
to_path = to_path+'\\'+newdir
if not os.path.exists(to_path):
os.mkdir(to_path) # make directory
print 'Successfully created directory2', to_path
for file in os.listdir(from_path):
type = os.path.splitext(file)[1]
if type == ".pbd" or type == ".exe" or type == ".ini":
print from_path
print to_path
#shutil.copy(from_path+'\\'+file, os.path.join("c:\\image\\"+"backup", file))
shutil.copy(from_path+'\\'+file, os.path.join(to_path, file))