Skip to content

Commit

Permalink
iis windows
Browse files Browse the repository at this point in the history
  • Loading branch information
tomerb3 authored Jan 25, 2018
1 parent 1325994 commit d315073
Showing 1 changed file with 46 additions and 0 deletions.
46 changes: 46 additions & 0 deletions update_iis_web_in_windows .py
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
import os
import glob
import shutil
import sys
import getopt
import logging
import subprocess




def copy_ext_files(source_dir, dest_dir, ext):
if not os.path.exists(source_dir):
logging.error("Source folder %s not exist" % source_dir)
sys.exit(1)
if not os.path.exists(dest_dir):
logging.info("Target folder %s not exist. now created" % dest_dir)
os.makedirs(dest_dir)
os.chdir(source_dir)
for file in glob.glob(ext):
try:
shutil.copy2(os.path.join(source_dir, file), dest_dir)
except IOError as e:
print "Copy Problem : %s" % e
sys.exit(1)



source_dir = 'c:\\git\\source'
target_dir = 'C:\\inetpub\\wwwroot'
ext_list = ['*.html','*.htm']

#Update Files
for ext in ext_list:
print ext
copy_ext_files(source_dir, target_dir, ext)


#Restrat IIS
command_stop = "net stop w3svc"
command_start = "net start w3svc"
proc = subprocess.call(command_stop)
proc = subprocess.call(command_start)



0 comments on commit d315073

Please sign in to comment.