#-*-coding:gbk-*- #gbk可以识别windows文件里面的中文import osimport sysdef check_backup_info(path): &
#-*-coding:gbk-*- #gbk可以识别windows文件里面的中文import osimport sysdef 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
--结束END--
本文标题: 检查备份情况的脚本
本文链接: https://www.lsjlt.com/news/230024.html(转载时请注明来源链接)
有问题或投稿请发送至: 邮箱/279061341@qq.com QQ/279061341
2024-05-24
2024-05-24
2024-05-24
2024-05-24
2024-05-24
2024-05-24
2024-05-24
2024-05-24
2024-05-24
2024-05-24
回答
回答
回答
回答
回答
回答
回答
回答
回答
回答
0