@echo off
setlocal enabledelayedexpansion
for /l %%i in (1 1 5) do echo.
echo 1. 按【月份】归档【文件】
echo 2. 按【月份】归档【文件夹】
set/p n=(1/2):
goto :%n%
goto :eof
:1
for /l %%i in (1 1 5) do echo.
echo 按【月份】归档【文件】,按任意键继续,退出关闭窗口
for /l %%i in (1 1 5) do echo.
pause>nul
for /f "tokens=4" %%i in ('dir/a-d ^|find "/"') do (
if "%%j" NEQ "%~nx0" (
set "a=%%i"
set "a=%%~ti"
set "a=!a:~,7!"
set "a=!a:/=\!"
md !a! 2>nul
move "%%i" !a!
)
)
pause
:2
for /l %%i in (1 1 5) do echo.
echo 按【月份】归档【文件夹】,按任意键继续,退出关闭窗口
for /l %%i in (1 1 5) do echo.
pause>nul
for /f "tokens=4" %%i in ('dir/ad ^|find/i "<DIR>"') do (
set "b=%%~ti"
set "b=!b:~,7!"
set "b=!b:/=\!"
echo !b!
md !b! 2>nul
move %%i !b!
)
pause
© 著作权归作者所有
文章评论(0)