@echo off
title 清理%max_days%天以前的備份
:: set folder path
set file_path=E:\SOFT\OA_BAK\2018
:: set min age of files and folders to delete
set max_days=7
echo ********************
echo 正在清除%max_days%天以前的OA備份文件,請稍後......
:: remove sub directories from %file_path%
forfiles -p %file_path% -d -%max_days% -c "cmd /c IF @isdir == TRUE rd /S /Q @path" /srem