You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
QingLong/Doc/方法与技巧/Navicat定时清除数据库备份.md

2.1 KiB

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

【Navicat】定时清除数据库备份并保留最近7天

黄海整理

1. 打开任务计划程序

此电脑---右键-管理----弹出如下界面

  • Step1 创建基本任务

  • Step2 设置每天13:00 (午休时间,可以自行设置)

  • Step3 创建脚本,并设置

脚本文件 delte_bak.bat

注意:路径不能包含中文否则会报错。

forfiles /p "C:\Users\Administrator\Documents\Navicat\PostgreSQL\Servers\10.10.14.14\gtzz_base_db\public" /m *.nb3 /d -7 /c "cmd /c del @path"  
CHOICE /T 7 /C ync /CS /D y /n
exit

2. 测试

测试任务效果,右键点击运行看结果(立即运行)

ERROR: No files found with the specified search criteria. 表示没有要清理的文件(因为作者这里已经清理过)

查看文件夹7天之前的备份文件已删除