Advertisement
dropbox1349

Estrai archivi presenti in cartelle diverse nelle stesse cartelle

Feb 5th, 2021
1,186
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Video youtube
  2. https://youtu.be/HCjYaSu12Rg
  3.  
  4. Codice
  5. ---------------------------------------------------------
  6. @echo off
  7. setlocal EnableExtensions DisableDelayedExpansion
  8. set "SourceFolder=C:\alfa\beta\gamma"
  9. set "LogExtract=%SourceFolder%\ExtractionLog.txt"
  10. set "LogError=%SourceFolder%\ErrorLog.txt"
  11. set "ArchiveExtracted="
  12.  
  13. del /Q "%LogExtract%" "%LogError%" 2>nul
  14.  
  15. for /D %%I in ("%SourceFolder%\*") do (
  16.     if /I not "%%~nxI" == "done" (
  17.         for %%J in ("%%I\*.rar" "%%I\*.zip") do (
  18.             if exist "%%J" (
  19.                 echo Extracting "%%J" ...
  20.                 "%ProgramFiles%\WinRAR\WinRAR.exe" x -cfg- -ibck -logpfu="%LogExtract%" -o+ -y -- "%%J" "%%I\"
  21.                 if errorlevel 1 (
  22.                     set "ArchiveFile=%%J"
  23.                     >>"%LogError%" call echo Error %%ErrorLevel%% on extracting "%%ArchiveFile%%"
  24.                 ) else (
  25.                     set "#%%~nxI=%%I"
  26.                     set "ArchiveExtracted=1"
  27.                     echo %%~nJ| %SystemRoot%\System32\findstr.exe /I /R "\.part[0123456789][0123456789]*$" >nul
  28.                     if errorlevel 1 ( del /F "%%J" ) else for %%# in ("%%~nJ") do del /F /Q "%%I\%%~n#.part*%%~xJ"
  29.                 )
  30.             )
  31.         )
  32.     )
  33. )
  34.  
  35.  
  36.  
  37. endlocal
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement