Advertisement
HTWingNut

Windows Batch CRC 7Zip 5

Aug 25th, 2022 (edited)
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.65 KB | None | 0 0
  1. @echo off
  2. REM by HTWINGNUT 08/25/2022
  3. REM Request from r/datahoarder
  4.  
  5. if exist _extractnew.txt del _extractnew.txt
  6. if exist _extract.txt del _extract.txt
  7.  
  8. set "toggle=0"
  9. set "cf=%~dp0"
  10. Echo Current folder: %cf%
  11. ECHO(
  12. ECHO *** Extract CRC's from 7z files
  13. ECHO(
  14.  
  15. :enterpathfile
  16.  
  17. set /p "zippth=Enter path zip files: "
  18.  
  19. if not exist "%zippth%\" (
  20. echo *** Folder does not exist, please try again...
  21. echo(
  22. goto :enterpathfile
  23. )
  24. ECHO %DATE% %TIME% >_extractnew.txt
  25.  
  26. FOR /R "%zippth%" %%t in ("*.7z") DO (
  27.  
  28. SET "zipfile=%%t"
  29. CALL :crczip
  30. ECHO( >>_extractnew.txt
  31. )
  32.  
  33. GOTO :FINISH
  34.  
  35. :crczip
  36.  
  37. ECHO FILE: %zipfile% >>_extractnew.txt
  38.  
  39. for %%p in ("%zipfile%") do (
  40. set "zippath=%%~dpp"
  41. )
  42. set "zippath=%zippath:~0,-1%"
  43.  
  44. (for /f "tokens=2* delims==" %%i in ('7z.exe l -slt "%zipfile%" ^| findstr /i "path crc"') do (
  45.  
  46. if /i "%%i" NEQ " %zipfile%" (
  47. echo %%i
  48. )
  49. )
  50. ) >_extract.txt
  51.  
  52. for /f "delims=" %%a in (_extract.txt) do (
  53. set "line=%%a"
  54. set "fullpth=%%~fa"
  55. CALL :extract
  56. )
  57.  
  58. findstr /v "ECHO is off" _extractnew.txt > crclist.txt
  59.  
  60. GOTO :EOF
  61.  
  62. :extract
  63.  
  64. if "%line:~0,1%" EQU " " (set "line=%line:~1%")
  65.  
  66. if %toggle% equ 0 (
  67. call :setpth
  68. )
  69.  
  70. if %toggle% equ 1 (
  71. call :setpth2
  72. )
  73.  
  74. if %toggle% equ 0 (set toggle=1) else (
  75. call :toggle
  76. )
  77.  
  78.  
  79. if %toggle% equ 0 echo %pth%
  80.  
  81. GOTO :EOF
  82.  
  83. :setpth
  84. set "pth=%zippath%\%line%"
  85. goto :eof
  86.  
  87. :setpth2
  88. set "pth=%line% %pth%"
  89. goto :eof
  90.  
  91. :toggle
  92. set toggle=0
  93. echo %pth% >>_extractnew.txt
  94. goto :eof
  95.  
  96. :FINISH
  97. ECHO(
  98. ECHO *** COMPLETE!!!
  99. ECHO(
  100. ECHO *** Results stored in '%cf%crclist.txt'
  101. ECHO(
  102. PAUSE
  103.  
  104. del _extract.txt 2>null
  105. del _extractnew.txt 2>null
  106.  
  107.  
  108.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement