cluster
Код:
@echo off
setlocal enabledelayedexpansion
set "folder=f:\"
set "copy_to=f:\testc\"
for %%a in (%folder%*.*) do (
set "file_date=%%~ta"
set "file_dm=!file_date:~0,5!"
if "!file_dm!"=="31.01" call :copy_file "%%a"
if "!file_dm!"=="29.02" call :copy_file "%%a"
if "!file_dm!"=="28.02" call :copy_file "%%a"
if "!file_dm!"=="31.03" call :copy_file "%%a"
if "!file_dm!"=="30.04" call :copy_file "%%a"
if "!file_dm!"=="31.05" call :copy_file "%%a"
if "!file_dm!"=="30.06" call :copy_file "%%a"
if "!file_dm!"=="31.07" call :copy_file "%%a"
if "!file_dm!"=="31.08" call :copy_file "%%a"
if "!file_dm!"=="30.09" call :copy_file "%%a"
if "!file_dm!"=="31.10" call :copy_file "%%a"
if "!file_dm!"=="30.11" call :copy_file "%%a"
if "!file_dm!"=="31.12" call :copy_file "%%a"
)
forfiles /p %folder% /m *.* /d -8 /c "cmd /c if @isdir==FALSE del /q /f @path"
goto :EOF
:copy_file
copy %1 %copy_to% > nul
Код:
@echo off
setlocal enabledelayedexpansion
set "folder=f:\"
set "copy_to=f:\testc\"
for %%a in (%folder%*.*) do (
set "file_date=%%~ta"
set "file_dm=!file_date:~0,5!"
if "!file_dm!"=="31.01" call :copy_file "%%a"
if "!file_dm!"=="29.02" call :copy_file "%%a"
if "!file_dm!"=="28.02" call :copy_file "%%a"
if "!file_dm!"=="31.03" call :copy_file "%%a"
if "!file_dm!"=="30.04" call :copy_file "%%a"
if "!file_dm!"=="31.05" call :copy_file "%%a"
if "!file_dm!"=="30.06" call :copy_file "%%a"
if "!file_dm!"=="31.07" call :copy_file "%%a"
if "!file_dm!"=="31.08" call :copy_file "%%a"
if "!file_dm!"=="30.09" call :copy_file "%%a"
if "!file_dm!"=="31.10" call :copy_file "%%a"
if "!file_dm!"=="30.11" call :copy_file "%%a"
if "!file_dm!"=="31.12" call :copy_file "%%a"
)
forfiles /p %folder% /m *.* /d -8 /c "cmd /c if @isdir==FALSE del /q /f @path"
goto :EOF
:copy_file
copy %1 %copy_to% > nul