#-*-coding:gbk-*-#gbk可以识别windows文件里面的中文importosimportsysdefcheck_backup_info(path):print('\n')filelist=os.popen('dir/O-D%s>c:/temp.txt'%path).read()#popen可以执行本地命令withopen('c:/temp.txt')asf:print("*************最近备份的文件如下:****************")forindex,lineinenumerate(f,1):if"的卷没有标签"inline:passelif"卷的序列号是"inline:passelif"字节"inline:passelifline.split():#删除空行printlineifindex==12:breakos.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