您好,登录后才能下订单哦!
#-*-coding:gbk-*- #gbk可以识别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可以执行本地命令 with open('c:/temp.txt') as f: print("*************最近备份的文件如下:****************") for index,line in enumerate(f,1): if "的卷没有标签" in line: pass elif "卷的序列号是" in line: pass elif "字节" in line: pass elif line.split(): #删除空行 print line if index == 12: break os.remove('c:/temp.txt') #主程序 if __name__ == '__main__': check_backup_info('D:\\数据备份\\BMS3') check_backup_info('D:\\数据备份\\IWSDB1040') check_backup_info('D:\\数据备份\\U8账套\\001-031') check_backup_info('D:\\数据备份\\U8账套\\100-153') check_backup_info('D:\\数据备份\\U8账套\\191-195') check_backup_info('D:\\数据备份\\U8账套\\545-561') check_backup_info('D:\\数据备份\\U8账套\\642-810') check_backup_info('D:\\数据备份\\U8账套\\901-960') check_backup_info('D:\\数据备份\\客服共享0122') check_backup_info('D:\\backup\\LocalUser\\ora12') check_backup_info('D:\\backup\\LocalUser\\wyerp')
运行后:
***********最近备份的文件如下:****************
D:\数据备份\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:\数据备份\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
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。