Skip to content

Instantly share code, notes, and snippets.

Last active Mar 14, 2020
What would you like to do?
compress a folder with 7z using a gitignore list
# the resulting file will be like name_2019-12-01.7z
Function Pack-Folder {
param($name, $folder, $ignoreFile=".gitignore", $useDate=$true)
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