复制代码
- ::Function-----------------------------------------------------------------
- :Folder
- Set "Folder="
- Set /p Folder=Folder Name:
- IF NOT DEFINED Folder Cls & Goto Folder
- Call :Check !Folder!
- Goto :eof
- :Check //FolderName
- Set "Folder=%~1"
- IF "!Folder!"=="?" Cls & Goto Folder
- IF NOT EXIST "!Folder!" Cls & Echo !Folder! DOES NOT EXIST! & Goto Folder
- For /f "usebackq tokens=* delims= eol=" %%i in ('!Folder!') do (
- Set "ATTR=%%~ai" & Set "ATTR=!ATTR:~0,1!"
- IF /I NOT "!ATTR!"=="d" Cls & Echo !Folder! DOES NOT A Folder & Goto Folder
- )
- Goto Choice
- Goto :eof
- :CheckFiles
- Echo -----------------------------------------------------------------------
- Set "All=0"
- Set "Num=0"
- For %%i in (!Type!) do (
- For /R "%Folder%" %%j in (*.%%i) do Set /a Num+=1
- Set /p= %%i:!Num! <nul
- Set /a All=!Num!+!All!
- Set "Num=0"
- )
- Echo Total:!All!
- Echo -----------------------------------------------------------------------
- Title !Title! ^| Total:!All! Done:0
- Goto :eof
- :CheckFolder //Type or Date [Folder]
- IF /i "%~1"=="Type" (
- IF NOT EXIST PhotoFinisher\Type\JPG Md PhotoFinisher\Type\JPG
- IF NOT EXIST PhotoFinisher\Type\BMP Md PhotoFinisher\Type\BMP
- IF NOT EXIST PhotoFinisher\Type\JPEG Md PhotoFinisher\Type\JPEG
- IF NOT EXIST PhotoFinisher\Type\GIF Md PhotoFinisher\Type\GIF
- IF NOT EXIST PhotoFinisher\Type\PNG Md PhotoFinisher\Type\PNG
- )
- IF /i "%~1"=="Date" IF NOT EXIST PhotoFinisher\Date\%~2年\%~3月\%~4日 Md PhotoFinisher\Date\%~2年\%~3月\%~4日
- Goto :eof
- :CheckSame //Type or Date
- Set "Same=0"
- If /i "%~1"=="Type" (
- For /R "%cd%\PhotoFinisher\Type\%~3" %%x in (*.%~3) do Set /a Same+=1
- If "!Same!"=="0" (
- Copy "%~4" "PhotoFinisher\Type\%~3" >nul 2>nul
- Call :ADD %ERRORLEVEL%
- ) ELSE (
- Copy "%~4" "PhotoFinisher\Type\%~3\%~2_!Same!.%~3" >nul 2>nul
- Call :ADD %ERRORLEVEL%
- )
- )
- If /i "%~1"=="Date" (
- For /R "%cd%\PhotoFinisher\Date\%~5年\%~6月\%~7日" %%x in (*.%~3) do Set /a Same+=1
- If "!Same!"=="0" (
- Copy "%~4" "PhotoFinisher\Date\%~5年\%~6月\%~7日" >nul 2>nul
- Call :ADD %ERRORLEVEL%
- ) ELSE (
- Copy "%~4" "PhotoFinisher\Date\%~5年\%~6月\%~7日\%~2_!Same!.%~3" >nul 2>nul
- Call :ADD %ERRORLEVEL%
- )
- )
- Goto :eof
- :Type
- Title !Title! ^| Total:!All! Done:0 ^| Type Mode
- Set "NumDone=0"
- Call :AreUSure Type
- Call :CheckFolder Type
- For %%i in (!Type!) do For /R "%Folder%" %%j in (*.%%i) do Call :CheckSame Type "%%~nj" "%%i" "%%j"
- Call :Result Type
- Goto :eof
- :Date
- Title !Title! ^| Total:!All! Done:0 ^| Date Mode
- For %%i in (!Type!) do (For /r "%Folder%" %%j in (*.%%i) do (
- For /f "tokens=1-3 delims=/ " %%m in ("%%~tj") do Call :CheckFolder Date %%m %%n %%o))
- Call :AreUSure Type
- For %%i in (!Type!) do (For /r "%Folder%" %%j in (*.%%i) do (For /f "tokens=1-3 delims=/ " %%m in ("%%~tj") do (
- Call :CheckSame Date "%%~nj" "%%i" "%%j" %%m %%n %%o)))
- Call :Result Date
- Goto :eof
- :ADD
- If "%ERRORLEVEL%"=="0" (
- Set /a NumDone+=1
- Title !Title! ^| Total:!All! Done:!NumDone! ^| Type Mode
- )
- Goto :eof
- :AreUSure
- Set /p Choice=Using %~1 Mode. Are you sure? (Y/N):
- If /i "!Choice:~0,1!"=="Y" Goto :eof
- If /i "!Choice:~0,1!"=="N" Cls & Goto Choice
- Goto AreUSure %~1
- Goto :eof
- :Result
- Echo -----------------------------------------------------------------------
- Echo %~1 Mode Total:!All! Done:!NumDone!
- Echo -----------------------------------------------------------------------
- Echo CopyRight (C) Canyuexiaolang
- Ping 127.1 -n 5 >nul & Exit
- Goto :eof
- ::Function------------------------------------------------------------------
欢迎光临 批处理之家 (http://bbs.bathome.net/) | Powered by Discuz! 7.2 |