@echo off
::setting the local extensions
setlocal enableextensions
setlocal enabledelayedexpansion
::setting the path and date
:: %~dp0 this cmd fetch the path from where the script is running.(removed)
set /p path=Enter the path where the script has to be Run:
cd %path%
echo.%path%
echo. %date% %time% >>deletionlog.log
del *.* /s /q >null >>deletionlog.log
pause...
这是我使用的脚本,但我是批处理脚本的新手。
我无法从用户那里获取日期,应该删除该日期之下的文件。
答案 0 :(得分:0)
从我的备份脚本中提取:
设置backupdir =“%cd%”
设置remove_old_after_days = 14
forfiles -p%backupdir%-s -m * .zip / D - %remove_old_after_days%/ C“cmd / c del @path”