Skip to content

Commit

Permalink
Adds TempFolder parameter to Compress-7Zip (closes #78)
Browse files Browse the repository at this point in the history
Updates readme
  • Loading branch information
thoemmi committed Apr 13, 2023
1 parent a98890d commit 209f170
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
8 changes: 8 additions & 0 deletions 7Zip4Powershell/Compress7Zip.cs
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,10 @@ public class Compress7Zip : ThreadedCmdlet {
[Parameter(HelpMessage = "Allows setting additional parameters on SevenZipCompressor")]
public ScriptBlock CustomInitialization { get; set; }

[Parameter(HelpMessage = "The temporary folder path; if not specified, %TEMP% will be used")]
[CanBeNull]
public string TempFolder { get; set; }

[Parameter(HelpMessage = "Enables encrypting filenames when using the 7z format")]
public SwitchParameter EncryptFilenames { get; set; }

Expand Down Expand Up @@ -177,6 +181,10 @@ public override void Execute() {
PreserveDirectoryRoot = _cmdlet.PreserveDirectoryRoot.IsPresent,
CompressionMode = _cmdlet.Append.IsPresent ? CompressionMode.Append : CompressionMode.Create
};

if (!string.IsNullOrEmpty(_cmdlet.TempFolder)) {
compressor.TempFolderPath = _cmdlet.TempFolder;
}

_cmdlet.CustomInitialization?.Invoke(compressor);

Expand Down
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ Compress-7Zip
[-CompressionMethod <CompressionMethod> {Copy | Deflate | Deflate64 | BZip2 | Lzma | Lzma2 | Ppmd | Default}]
[-Password <string>] | [-SecurePassword <securestring>]
[-CustomInitialization <ScriptBlock>]
[-TempFolder <string>]
[-IncludeHidden]
[-IncludeSystem
[-EncryptFilenames]
[-VolumeSize <int>]
[-FlattenDirectoryStructure]
Expand Down Expand Up @@ -86,6 +89,11 @@ A list of all custom parameters can be found [here](https://sevenzip.osdn.jp/chm

## Changelog

### [v2.3](https://github.com/thoemmi/7Zip4Powershell/releases/tag/v2.3)

* Updates 7-Zip libraries to 22.01 and NuGet packages (contributed by [@kborowinski](https://github.com/kborowinski) in [#84](https://github.com/thoemmi/7Zip4Powershell/pull/84))
* Adds `TempFolder` parameter to `Compress-7Zip` (requested in [#78](https://github.com/thoemmi/7Zip4Powershell/issues/78))

### [v2.2](https://github.com/thoemmi/7Zip4Powershell/releases/tag/v2.2)

* Updates 7-Zip libraries to 22.00 (contributed by [@kborowinski](https://github.com/kborowinski) in [#80](https://github.com/thoemmi/7Zip4Powershell/pull/80))
Expand Down

0 comments on commit 209f170

Please sign in to comment.