首页 > 其他分享 >bat cmd 无效参数/选项 - deleting

bat cmd 无效参数/选项 - deleting

时间:2023-01-05 17:33:57浏览次数:65  
标签:bat his Backup cmd DB 2% rem date deleting

Window bat expdp 数据库定时任务逻辑备份数据库 定时删除N天前的旧文件
Linux shell crontab expdp 定时任务逻辑备份数据库 定时删除旧文件

错误配置

forfiles 命令,目录路径最后多了""

rem 每天备份脚本
mysqldump -uroot -p123456 iron_his > D:\Software\0.DB.Backup\his_%date:~0,4%%date:~5,2%%date:~8,2%.sql

rem delete 5 days files
forfiles /p "D:\Software\0.DB.Backup\" /d  -5 /c "cmd /c echo deleting @file ... && del /f @path"

image

正确配置

rem 每天备份脚本
mysqldump -uroot -p123456 iron_his > D:\Software\0.DB.Backup\his_%date:~0,4%%date:~5,2%%date:~8,2%.sql

rem delete 5 days files
forfiles /p "D:\Software\0.DB.Backup" /d  -5 /c "cmd /c echo deleting @file ... && del /f @path"

image

标签:bat,his,Backup,cmd,DB,2%,rem,date,deleting
From: https://www.cnblogs.com/vipsoft/p/17028355.html

相关文章