Skip to content

Instantly share code, notes, and snippets.

@Ademking
Created March 15, 2019 18:03
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Ademking/70b1d62ffc108161177c03e43c96ff64 to your computer and use it in GitHub Desktop.
Save Ademking/70b1d62ffc108161177c03e43c96ff64 to your computer and use it in GitHub Desktop.
Compress folders (and exclude some folders) using Winrar CLI

To compress a folder using Winrar CLI

"%ProgramFiles%\WinRAR\Rar.exe" a -x*\FOLDER_TO_EXCLUDE "RESULT_NAME.rar" .\FOLDER_TO_INCLUDE

Example :

@ECHO off
SETLOCAL

:: Get date & time now
FOR /f %%a in ('WMIC OS GET LocalDateTime ^| find "."') DO Set _DTS=%%a
Set _datetime=%_DTS:~0,4%-%_DTS:~4,2%-%_DTS:~6,2%@%_DTS:~8,2%-%_DTS:~10,2%-%_DTS:~12,2%

"%ProgramFiles%\WinRAR\Rar.exe" a -x*\node_modules -x*\vendor "project-%_datetime%.rar" .\clientSide .\serverSide
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment