假期快要結束了,沉寂了小半個月~打開筆記本,翻到翻到相片,發現一個14年寫的win批處理。恩~還挺好用的,不知道批處理的點擊:批處理_百度百科 查看。
github地址: MatrixSeven/MovePhotos 歡迎來訪,若是喜歡,還請順手來個star~java
主要功能就是把目錄下的相片按照日期分類,直接把要處理的目錄拖到這個黑框上就ok了~而後選擇1~4處理類型,回車,就能看到效果了。git
@echo off&&setlocal enableextensions title PhotosMoves By:Seven&&color 0D MODE CON COLS=64 LINES=15 set mycolor="9ABCDEF" set "sevens=call :seven"&&set "end=@echo." set myName=%~n0 if "%myName%" neq "se7en" ( @echo. &&@echo.&&@echo 文件部分~損~壞,請將文件名修改成se7en後方可正常運行。 @echo. &&@echo.&&@echo 自動修復中ing完成...任意鍵從新啓動。 @echo. &&%sevens% D " By@林小柒 QQ:"&&%sevens% 9 "9"&&%sevens% A "8"&&%sevens% B "5"&&%sevens% C "3"&&%sevens% D "9"&&%sevens% E "0"&&%sevens% F "9"&&%sevens% A "2"&&%sevens% C "7" rename %0 se7en.bat pause>nul se7en.bat&exit ) :f goto main :k set /p select="請選擇要處理的類型:" if "%select%" == "1" goto f1 if "%select%" == "2" goto f2 if "%select%" == "3" goto f3 if "%select%" == "4" goto f4 if "%select%" == "5" goto f5 if "%select%" == "6" exit goto f :f1 for /r %%a in ("*.jpg") do set "t=%%~ta"&&call :movesByDd "%%a" %%t%% goto :dels :f2 for %%a in ("*.jpg") do set "t=%%~ta"&&call :movesByDd "%%a" %%t%% goto :dels :f3 for /r %%a in ("*.jpg") do set "t=%%~ta"&&call :movesByMm "%%a" %%t%% goto :dels :f4 for %%a in ("*.jpg") do set "t=%%~ta"&&call :movesByMm "%%a" %%t%% goto :dels :f5 @echo 把這個文件放到你要處理相片的目錄下運行>D:\help.txt @echo 會按照照相的日期生成文件夾而且按照日期對相片進行移動或者分類>>D:\help.txt start notepad.exe "D:\help.txt" goto k :dels for /f "delims=" %%s in ('dir /s /ad /b') do rd /q "%%s" 2>nul 1>nul del /f /q "C:\help.txt" 2>nul 1>nul goto f :movesByDd set dates=%2&&call set dates=%%dates:/=-%% md %dates% 2>nul 1>nul move %1 %dates% set /a p=p+1 goto :eof :movesByMm set dates=%2&&call set dates=%%dates:/=-%%&&call set dates=%%dates:~0,7%% md %dates% 2>nul 1>nul move %1 %dates% set /a p=p+1 goto :eof :main cls %sevens% E "┌─────────────────────────────┐"&&%end% %sevens% E "│"&&%sevens% C " 相片分類工具"&&%sevens% E " │"&&%end% %sevens% E "│"&&%sevens% A " 1.分類目錄下全部相片(按天)"&&%sevens% E " │"&&%end% %sevens% E "│"&&%sevens% A " 2.分類當前目錄下相片(按天)"&&%sevens% E " │"&&%end% %sevens% E "│"&&%sevens% A " 3.分類目錄下全部相片(按月)"&&%sevens% E " │"&&%end% %sevens% E "│"&&%sevens% A " 4.分類當前目錄下相片(按月)"&&%sevens% E " │"&&%end% %sevens% E "│"&&%sevens% A " 5.超級詳細的幫助文檔"&&%sevens% E " │"&&%end% %sevens% E "│"&&%sevens% A " 6.退出"&&%sevens% E " │"&&%end% %sevens% E "│"&&%sevens% F " @Seven 2014-8-24"&&%sevens% E " │"&&%end% %sevens% E "│"&&%sevens% F " QQ:"&&%sevens% 9 "9"&&%sevens% A "8"&&%sevens% B "5"&&%sevens% C "3"&&%sevens% D "9"&&%sevens% E "0"&&%sevens% F "9"&&%sevens% A "2"&&%sevens% C "7"&&%sevens% E " │"&&%end% %sevens% E "└─────────────────────────────┘"&&%end% if defined p echo ok.成功的分類了 %p% 張相片&&set /a p=0 set files=nul set select=nul if not defined "%files%" set /p files="請拽入要處理的目錄 6退出:" if "%files%" equ "6" exit if not exist "%files%" @call %sevens% A 文件路徑不存在,任意鍵繼續&&pause>nul&&goto main for %%a in ("%files%") do set "b=%%~aa" if defined b (if %b:~0,1% neq d (@echo 拽入的不是目錄,任意鍵繼續&&pause>nul&&goto main )) cd /d "%files%" goto k :seven pushd "%temp%"&set/p= <nul>"%~2"&findstr /a:%~1 .* "%~2" nul&del "%~2"&popd