#获取所有文件def file(): for cur_dir, dirs, files in os.walk(r'/学习/接口自动化/BestTest/作业/logs'): # cur_dir(当前路径),dirs(目录),files(文件)中所有的 for file in files: abs_path = os.path.join(cur_dir, file) # 获取绝对路径 if int(timestamp_to_str(abs_path.split("_")[1].split
点击进入:Linux shell crontab expdp 定时任务逻辑备份 定时删除旧文件 首先建一个备份数据库用批处理文件,内容如下: rem expdp sz set sz_file=SZ_%date:~0,4%%date:~5,2%%date:~8,2%.dmp set sz_logfile=SZ_%date:~0,4%%date:~5,2%%date:~8,2%.log expdp user/pwd schemas=user_schema directory=dump_dir DUM
原文:用批处理文件自动备份文件及文件夹,并自动删除n天前的文件 ---恢复内容开始--- 下是备份的批处理,添加到"计划任务"中,设定时间自动运行 复制代码 代码如下:@echo off rem 格式化日期 rem date出来的日期是"2006-02-22 星期三",不能直接拿来使用,所以应该先格式化一下 rem 变成我们想要的.date:~0,4的意思是从0开始截取4个字符 set d=%date:~0,4%%date:~5,2%%date:~8,2% rem
压缩.log 文件为zip后删除原文件 需要注意:本人作为小白,该脚本需要和.log在一起,后面有时间需要改正. #!/usr/local/python/bin/python #-*-coding=utf8 -*- import time import os import sys import zipfile N = 7 #设置删除多少天前的文件 def zip(srcpath): for folder,sumfolder,files in os.walk(srcpath): for file