1. 程式人生 > >BAT指令碼刪除指定路徑指定日期檔案

BAT指令碼刪除指定路徑指定日期檔案

::刪除指定路徑圖片資源,(+/-)(日期之後/日期之前)
::指令 deleteImage.bat C:\Users\Administrator\Desktop\TestImage jpg +2018/12/01
@echo off
::C:\Users\Administrator\Desktop\TestImage\
set file_path=%1
::jpg
set img_suffix=%2
::+2018/12/01
set img_date=%3
if exist %file_path% (
    echo file path is find!
    forfiles /p %file_path% /s /m *.%img_suffix% /d %img_date% /c "cmd /c del /f /q /a @path"
    echo delete is success
) else (
    echo file path is not found!
)
pause>nul