Search code examples
batch-fileunzipexists

How to skip unzipping a file that already exists?


ECHO Unzipping "%build1%"...
unzip -o "%build1%" -d "%exbuild1%" >NUL

ECHO Done.
ECHO.

ECHO Unzipping "%build2%"...
unzip -o "%build2%" -d "%exbuild2%" >NUL

ECHO Done.
ECHO.

How to skip unzipping a file that already exists? If the unzipped file is not esists, unzip it.


Solution

  • if not exist "%exbuild1%\%build1%" (
      ECHO Unzipping "%build1%"...
      unzip -o "%build1%" -d "%exbuild1%" >NUL
    
      ECHO Done.
      ECHO.
    ) else (
      ECHO Build already exists
    )
    

    ?

    See more about IF command.