[新手上路]批处理新手入门导读[视频教程]批处理基础视频教程[视频教程]VBS基础视频教程[批处理精品]批处理版照片整理器
[批处理精品]纯批处理备份&还原驱动[批处理精品]CMD命令50条不能说的秘密[在线下载]第三方命令行工具[在线帮助]VBScript / JScript 在线参考
返回列表 发帖

[文件操作] [分享]两年前写的批处理照片整理器

两年前写过照片整理器。我了个去那些错啊。还发到原创代码里面了。

今天给删了。。。。我又写了个

鉴于技术垃圾,就不往那里发了。。
  1. ::Function-----------------------------------------------------------------
  2. :Folder
  3. Set "Folder="
  4. Set /p Folder=Folder Name:
  5. IF NOT DEFINED Folder Cls & Goto Folder
  6. Call :Check !Folder!
  7. Goto :eof
  8. :Check //FolderName
  9. Set "Folder=%~1"
  10. IF "!Folder!"=="?" Cls & Goto Folder
  11. IF NOT EXIST "!Folder!" Cls & Echo !Folder! DOES NOT EXIST! & Goto Folder
  12. For /f "usebackq tokens=* delims= eol=" %%i in ('!Folder!') do (
  13. Set "ATTR=%%~ai" & Set "ATTR=!ATTR:~0,1!"
  14. IF /I NOT "!ATTR!"=="d" Cls & Echo !Folder! DOES NOT A Folder & Goto Folder
  15. )
  16. Goto Choice
  17. Goto :eof
  18. :CheckFiles
  19. Echo -----------------------------------------------------------------------
  20. Set "All=0"
  21. Set "Num=0"
  22. For %%i in (!Type!) do (
  23. For /R "%Folder%" %%j in (*.%%i) do Set /a Num+=1
  24. Set /p= %%i:!Num! <nul
  25. Set /a All=!Num!+!All!
  26. Set "Num=0"
  27. )
  28. Echo Total:!All!
  29. Echo -----------------------------------------------------------------------
  30. Title !Title! ^| Total:!All! Done:0
  31. Goto :eof
  32. :CheckFolder //Type or Date [Folder]
  33. IF /i "%~1"=="Type" (
  34. IF NOT EXIST PhotoFinisher\Type\JPG Md PhotoFinisher\Type\JPG
  35. IF NOT EXIST PhotoFinisher\Type\BMP Md PhotoFinisher\Type\BMP
  36. IF NOT EXIST PhotoFinisher\Type\JPEG Md PhotoFinisher\Type\JPEG
  37. IF NOT EXIST PhotoFinisher\Type\GIF Md PhotoFinisher\Type\GIF
  38. IF NOT EXIST PhotoFinisher\Type\PNG Md PhotoFinisher\Type\PNG
  39. )
  40. IF /i "%~1"=="Date" IF NOT EXIST PhotoFinisher\Date\%~2年\%~3月\%~4日 Md PhotoFinisher\Date\%~2年\%~3月\%~4日
  41. Goto :eof
  42. :CheckSame //Type or Date
  43. Set "Same=0"
  44. If /i "%~1"=="Type" (
  45. For /R "%cd%\PhotoFinisher\Type\%~3" %%x in (*.%~3) do Set /a Same+=1
  46. If "!Same!"=="0" (
  47. Copy "%~4" "PhotoFinisher\Type\%~3" >nul 2>nul
  48. Call :ADD %ERRORLEVEL%
  49. ) ELSE (
  50. Copy "%~4" "PhotoFinisher\Type\%~3\%~2_!Same!.%~3" >nul 2>nul
  51. Call :ADD %ERRORLEVEL%
  52. )
  53. )
  54. If /i "%~1"=="Date" (
  55. For /R "%cd%\PhotoFinisher\Date\%~5年\%~6月\%~7日" %%x in (*.%~3) do Set /a Same+=1
  56. If "!Same!"=="0" (
  57. Copy "%~4" "PhotoFinisher\Date\%~5年\%~6月\%~7日" >nul 2>nul
  58. Call :ADD %ERRORLEVEL%
  59. ) ELSE (
  60. Copy "%~4" "PhotoFinisher\Date\%~5年\%~6月\%~7日\%~2_!Same!.%~3" >nul 2>nul
  61. Call :ADD %ERRORLEVEL%
  62. )
  63. )
  64. Goto :eof
  65. :Type
  66. Title !Title! ^| Total:!All! Done:0 ^| Type Mode
  67. Set "NumDone=0"
  68. Call :AreUSure Type
  69. Call :CheckFolder Type
  70. For %%i in (!Type!) do For /R "%Folder%" %%j in (*.%%i) do Call :CheckSame Type "%%~nj" "%%i" "%%j"
  71. Call :Result Type
  72. Goto :eof
  73. :Date
  74. Title !Title! ^| Total:!All! Done:0 ^| Date Mode
  75. For %%i in (!Type!) do (For /r "%Folder%" %%j in (*.%%i) do (
  76. For /f "tokens=1-3 delims=/ " %%m in ("%%~tj") do Call :CheckFolder Date %%m %%n %%o))
  77. Call :AreUSure Type
  78. For %%i in (!Type!) do (For /r "%Folder%" %%j in (*.%%i) do (For /f "tokens=1-3 delims=/ " %%m in ("%%~tj") do (
  79. Call :CheckSame Date "%%~nj" "%%i" "%%j" %%m %%n %%o)))
  80. Call :Result Date
  81. Goto :eof
  82. :ADD
  83. If "%ERRORLEVEL%"=="0" (
  84. Set /a NumDone+=1
  85. Title !Title! ^| Total:!All! Done:!NumDone! ^| Type Mode
  86. )
  87. Goto :eof
  88. :AreUSure
  89. Set /p Choice=Using %~1 Mode. Are you sure? (Y/N):
  90. If /i "!Choice:~0,1!"=="Y" Goto :eof
  91. If /i "!Choice:~0,1!"=="N" Cls & Goto Choice
  92. Goto AreUSure %~1
  93. Goto :eof
  94. :Result
  95. Echo -----------------------------------------------------------------------
  96. Echo %~1 Mode Total:!All! Done:!NumDone!
  97. Echo -----------------------------------------------------------------------
  98. Echo CopyRight (C) Canyuexiaolang
  99. Ping 127.1 -n 5 >nul & Exit
  100. Goto :eof
  101. ::Function------------------------------------------------------------------
复制代码

消遣区斑竹表示鸭梨很大……

TOP

按什么规律整理啊?

TOP

回复 2# find


   只是练手罢了。和JM差了一大大大大大大截有木有。。

TOP

能否介绍一下跟这个的主要区别?
http://bbs.bathome.net/thread-69-1-1.html

TOP

返回列表