您好,登錄后才能下訂單哦!
#-*-coding:gbk-*- #gbk可以識(shí)別windows文件里面的中文 import os import sys def check_backup_info(path): print('\n') filelist = os.popen('dir /O-D %s > c:/temp.txt' % path).read() #popen可以執(zhí)行本地命令 with open('c:/temp.txt') as f: print("*************最近備份的文件如下:****************") for index,line in enumerate(f,1): if "的卷沒(méi)有標(biāo)簽" in line: pass elif "卷的序列號(hào)是" in line: pass elif "字節(jié)" in line: pass elif line.split(): #刪除空行 print line if index == 12: break os.remove('c:/temp.txt') #主程序 if __name__ == '__main__': check_backup_info('D:\\數(shù)據(jù)備份\\BMS3') check_backup_info('D:\\數(shù)據(jù)備份\\IWSDB1040') check_backup_info('D:\\數(shù)據(jù)備份\\U8賬套\\001-031') check_backup_info('D:\\數(shù)據(jù)備份\\U8賬套\\100-153') check_backup_info('D:\\數(shù)據(jù)備份\\U8賬套\\191-195') check_backup_info('D:\\數(shù)據(jù)備份\\U8賬套\\545-561') check_backup_info('D:\\數(shù)據(jù)備份\\U8賬套\\642-810') check_backup_info('D:\\數(shù)據(jù)備份\\U8賬套\\901-960') check_backup_info('D:\\數(shù)據(jù)備份\\客服共享0122') check_backup_info('D:\\backup\\LocalUser\\ora12') check_backup_info('D:\\backup\\LocalUser\\wyerp')
運(yùn)行后:
***********最近備份的文件如下:****************
D:\數(shù)據(jù)備份\BMS3 的目錄
2018-07-14 10:01 <DIR> ..
2018-07-14 10:01 <DIR> .
2018-07-14 00:10 2,895,775,744 BMS3_20180714.dmp
2018-07-14 00:10 26,027 BMS3_20180714.log
2018-07-06 09:21 0 2222222222222222222222222222222.txt
*************最近備份的文件如下:****************
D:\數(shù)據(jù)備份\IWSDB1040 的目錄
2018-07-14 14:17 <DIR> ..
2018-07-14 14:17 <DIR> .
2018-07-13 23:30 207 delete_1040_backup.log
2018-07-13 11:06 6,134 backup.log
2018-07-13 11:06 11,441 IWS_back_20180713.log
2018-07-13 11:06 3,210,194,944 IWS_back_20180713.dmp
2018-07-13 10:59 22,619 TMS_back_20180713.log
免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如果涉及侵權(quán)請(qǐng)聯(lián)系站長(zhǎng)郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。