Last active
March 14, 2020 00:19
-
-
Save BananaAcid/af2afa89c086de210c2fd647335b80f0 to your computer and use it in GitHub Desktop.
compress a folder with 7z using a gitignore list
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
node_modules | |
.git | |
.gitignore |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# the resulting file will be like name_2019-12-01.7z | |
Function Pack-Folder { | |
param($name, $folder, $ignoreFile=".gitignore", $useDate=$true) | |
$dStr; | |
if ($notUseDate) { | |
$dStr = "_$(Get-Date -UFormat %Y-%m-%d)" | |
} | |
else { | |
$dStr = "" | |
} | |
7z.exe a -t7z "$($name)$($dStr).7z" "$($folder)" -bd -mx9 -xr@"$($ignoreFile)" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment