diff --git a/Module/PSMinIO/PSMinIO.psd1 b/Module/PSMinIO/PSMinIO.psd1
index 836011d..0c2d207 100644
--- a/Module/PSMinIO/PSMinIO.psd1
+++ b/Module/PSMinIO/PSMinIO.psd1
@@ -71,6 +71,7 @@
'Get-MinIOObject',
'New-MinIOObject',
'Get-MinIOObjectContent',
+ 'Get-MinIOZipArchive',
'New-MinIOZipArchive'
)
diff --git a/scripts/Test-ZipArchive.ps1 b/scripts/Test-ZipArchive.ps1
index 4be9c86..f682ee4 100644
--- a/scripts/Test-ZipArchive.ps1
+++ b/scripts/Test-ZipArchive.ps1
@@ -53,10 +53,10 @@ try {
# Test 1: Create zip from FileInfo array
Write-Host "`n3. Test 1: Creating zip from FileInfo array..." -ForegroundColor Yellow
$mainFiles = Get-ChildItem $TestDirectory -File
- $zipPath1 = "test-files-array.zip"
-
+ $zipFile1 = [System.IO.FileInfo]"test-files-array.zip"
+
Write-Host " Creating zip with $($mainFiles.Count) files using Files parameter set" -ForegroundColor Cyan
- $result1 = New-MinIOZipArchive -DestinationPath $zipPath1 -Path $mainFiles -CompressionLevel Optimal -PassThru -Verbose
+ $result1 = New-MinIOZipArchive -DestinationPath $zipFile1 -Path $mainFiles -CompressionLevel Optimal -Verbose
Write-Host "✅ Files array zip created:" -ForegroundColor Green
Write-Host " Files: $($result1.FileCount)" -ForegroundColor White
@@ -67,10 +67,10 @@ try {
# Test 2: Create zip from directory (non-recursive)
Write-Host "`n4. Test 2: Creating zip from directory (non-recursive)..." -ForegroundColor Yellow
- $zipPath2 = "test-directory-flat.zip"
-
+ $zipFile2 = [System.IO.FileInfo]"test-directory-flat.zip"
+
Write-Host " Creating zip from directory (top-level files only)" -ForegroundColor Cyan
- $result2 = New-MinIOZipArchive -DestinationPath $zipPath2 -Directory (Get-Item $TestDirectory) -CompressionLevel Fastest -PassThru -Verbose
+ $result2 = New-MinIOZipArchive -DestinationPath $zipFile2 -Directory (Get-Item $TestDirectory) -CompressionLevel Fastest -Verbose
Write-Host "✅ Directory flat zip created:" -ForegroundColor Green
Write-Host " Files: $($result2.FileCount)" -ForegroundColor White
@@ -78,10 +78,10 @@ try {
# Test 3: Create zip from directory (recursive)
Write-Host "`n5. Test 3: Creating zip from directory (recursive)..." -ForegroundColor Yellow
- $zipPath3 = "test-directory-recursive.zip"
-
+ $zipFile3 = [System.IO.FileInfo]"test-directory-recursive.zip"
+
Write-Host " Creating zip from directory (recursive, all subdirectories)" -ForegroundColor Cyan
- $result3 = New-MinIOZipArchive -DestinationPath $zipPath3 -Directory (Get-Item $TestDirectory) -Recursive -IncludeBaseDirectory -CompressionLevel Optimal -PassThru -Verbose
+ $result3 = New-MinIOZipArchive -DestinationPath $zipFile3 -Directory (Get-Item $TestDirectory) -Recursive -IncludeBaseDirectory -CompressionLevel Optimal -Verbose
Write-Host "✅ Directory recursive zip created:" -ForegroundColor Green
Write-Host " Files: $($result3.FileCount)" -ForegroundColor White
@@ -89,55 +89,76 @@ try {
# Test 4: Create zip with file filtering
Write-Host "`n6. Test 4: Creating zip with file filtering..." -ForegroundColor Yellow
- $zipPath4 = "test-filtered-logs.zip"
-
+ $zipFile4 = [System.IO.FileInfo]"test-filtered-logs.zip"
+
Write-Host " Creating zip with only .log files using InclusionFilter" -ForegroundColor Cyan
- $result4 = New-MinIOZipArchive -DestinationPath $zipPath4 -Directory (Get-Item $TestDirectory) -Recursive -InclusionFilter { $_.Extension -eq ".log" } -CompressionLevel Optimal -PassThru -Verbose
-
+ $result4 = New-MinIOZipArchive -DestinationPath $zipFile4 -Directory (Get-Item $TestDirectory) -Recursive -InclusionFilter { $_.Extension -eq ".log" } -CompressionLevel Optimal -Verbose
+
Write-Host "✅ Filtered zip created:" -ForegroundColor Green
Write-Host " Log files: $($result4.FileCount)" -ForegroundColor White
Write-Host " Compression: $($result4.CompressionEfficiency.ToString('F1'))%" -ForegroundColor White
-
+
# Test 5: Append to existing zip (Update mode)
Write-Host "`n7. Test 5: Appending to existing zip..." -ForegroundColor Yellow
$csvFiles = Get-ChildItem $TestDirectory -Recurse -Filter "*.csv"
-
+
Write-Host " Appending $($csvFiles.Count) CSV files to existing zip" -ForegroundColor Cyan
- $result5 = New-MinIOZipArchive -DestinationPath $zipPath4 -Path $csvFiles -Mode Update -CompressionLevel Optimal -PassThru -Verbose
-
+ $result5 = New-MinIOZipArchive -DestinationPath $zipFile4 -Path $csvFiles -Mode Update -CompressionLevel Optimal -Verbose
+
Write-Host "✅ Files appended to zip:" -ForegroundColor Green
Write-Host " Total files now: $($result5.FileCount)" -ForegroundColor White
-
+
# Test 6: Create zip with custom base path
Write-Host "`n8. Test 6: Creating zip with custom base path..." -ForegroundColor Yellow
- $zipPath6 = "test-custom-basepath.zip"
-
+ $zipFile6 = [System.IO.FileInfo]"test-custom-basepath.zip"
+
Write-Host " Creating zip with custom base path (flattened structure)" -ForegroundColor Cyan
- $result6 = New-MinIOZipArchive -DestinationPath $zipPath6 -Directory (Get-Item $TestDirectory) -Recursive -BasePath $TestDirectory -CompressionLevel Optimal -PassThru -Verbose
-
+ $result6 = New-MinIOZipArchive -DestinationPath $zipFile6 -Directory (Get-Item $TestDirectory) -Recursive -BasePath $TestDirectory -CompressionLevel Optimal -Verbose
+
Write-Host "✅ Custom base path zip created:" -ForegroundColor Green
Write-Host " Files: $($result6.FileCount)" -ForegroundColor White
- # Verify all zip files
- Write-Host "`n9. Verifying created zip files..." -ForegroundColor Yellow
+ # Test 7: Get zip archive information
+ Write-Host "`n9. Test 7: Reading zip archive information..." -ForegroundColor Yellow
$zipFiles = Get-ChildItem "*.zip"
-
+
foreach ($zipFile in $zipFiles) {
- try {
- $archive = [System.IO.Compression.ZipFile]::OpenRead($zipFile.FullName)
- $entryCount = $archive.Entries.Count
- $archive.Dispose()
- Write-Host " ✅ $($zipFile.Name): $entryCount entries" -ForegroundColor Green
+ Write-Host " Reading archive: $($zipFile.Name)" -ForegroundColor Cyan
+
+ # Basic archive info
+ $archiveInfo = Get-MinIOZipArchive -ZipFile $zipFile -Verbose
+ Write-Host " Entries: $($archiveInfo.EntryCount)" -ForegroundColor White
+ Write-Host " Size: $([math]::Round($archiveInfo.TotalUncompressedSize / 1KB, 2)) KB -> $([math]::Round($archiveInfo.TotalCompressedSize / 1KB, 2)) KB" -ForegroundColor White
+ Write-Host " Compression: $($archiveInfo.CompressionEfficiency.ToString('F1'))%" -ForegroundColor White
+
+ # Detailed entries for one archive
+ if ($zipFile.Name -eq "test-directory-recursive.zip") {
+ Write-Host " Getting detailed entries for recursive archive..." -ForegroundColor Cyan
+ $detailedInfo = Get-MinIOZipArchive -ZipFile $zipFile -IncludeEntries -Verbose
+ Write-Host " Entry details: $($detailedInfo.Entries.Count) entries" -ForegroundColor White
+
+ # Show first few entries
+ $detailedInfo.Entries | Select-Object -First 3 | ForEach-Object {
+ Write-Host " $($_.FullName) ($([math]::Round($_.Length / 1KB, 2)) KB)" -ForegroundColor Gray
+ }
}
- catch {
- Write-Host " ❌ $($zipFile.Name): Verification failed - $($_.Exception.Message)" -ForegroundColor Red
+
+ # Validate integrity for one archive
+ if ($zipFile.Name -eq "test-files-array.zip") {
+ Write-Host " Validating archive integrity..." -ForegroundColor Cyan
+ $validatedInfo = Get-MinIOZipArchive -ZipFile $zipFile -ValidateIntegrity -Verbose
+ $validStatus = if ($validatedInfo.IsValid) { "✅ Valid" } else { "❌ Invalid" }
+ Write-Host " Validation: $validStatus (took $($validatedInfo.ValidationDuration.TotalMilliseconds.ToString('F0'))ms)" -ForegroundColor White
}
}
+
+ Write-Host "✅ Archive reading tests completed!" -ForegroundColor Green
# Summary
Write-Host "`n=== TEST SUMMARY ===" -ForegroundColor Cyan
Write-Host "✅ All zip archive tests completed successfully!" -ForegroundColor Green
- Write-Host "Features tested:" -ForegroundColor Yellow
+ Write-Host "New-MinIOZipArchive features tested:" -ForegroundColor Yellow
+ Write-Host " • FileInfo destination path parameter" -ForegroundColor White
Write-Host " • FileInfo[] parameter with Files parameter set" -ForegroundColor White
Write-Host " • Directory parameter with recursive and non-recursive modes" -ForegroundColor White
Write-Host " • File filtering with InclusionFilter ScriptBlock" -ForegroundColor White
@@ -145,7 +166,14 @@ try {
Write-Host " • Custom base path for entry name control" -ForegroundColor White
Write-Host " • Multiple compression levels (Optimal, Fastest)" -ForegroundColor White
Write-Host " • Comprehensive progress tracking and metrics" -ForegroundColor White
- Write-Host " • PassThru parameter for detailed results" -ForegroundColor White
+ Write-Host " • Always returns result objects (no PassThru needed)" -ForegroundColor White
+
+ Write-Host "Get-MinIOZipArchive features tested:" -ForegroundColor Yellow
+ Write-Host " • Basic archive information reading" -ForegroundColor White
+ Write-Host " • Detailed entry information with IncludeEntries" -ForegroundColor White
+ Write-Host " • Archive integrity validation" -ForegroundColor White
+ Write-Host " • Proper disposal handling with OpenRead" -ForegroundColor White
+ Write-Host " • Comprehensive metrics and compression statistics" -ForegroundColor White
Write-Host "`nZip files created:" -ForegroundColor Yellow
foreach ($zipFile in $zipFiles) {
diff --git a/src/Cmdlets/GetMinIOZipArchiveCmdlet.cs b/src/Cmdlets/GetMinIOZipArchiveCmdlet.cs
new file mode 100644
index 0000000..08bd67b
--- /dev/null
+++ b/src/Cmdlets/GetMinIOZipArchiveCmdlet.cs
@@ -0,0 +1,208 @@
+using System;
+using System.IO;
+using System.IO.Compression;
+using System.Linq;
+using System.Management.Automation;
+using PSMinIO.Core.Models;
+using PSMinIO.Utils;
+
+namespace PSMinIO.Cmdlets
+{
+ ///
+ /// Opens and reads zip archive information with proper disposal handling
+ ///
+ [Cmdlet(VerbsCommon.Get, "MinIOZipArchive")]
+ [OutputType(typeof(ZipArchiveInfo))]
+ public class GetMinIOZipArchiveCmdlet : MinIOBaseCmdlet
+ {
+ ///
+ /// Path to the zip archive file to read
+ ///
+ [Parameter(Position = 0, Mandatory = true, ValueFromPipeline = true, ValueFromPipelineByPropertyName = true)]
+ [ValidateNotNull]
+ [Alias("ZipPath", "Archive", "FullName")]
+ public FileInfo ZipFile { get; set; } = null!;
+
+ ///
+ /// Include detailed entry information for each file in the archive
+ ///
+ [Parameter]
+ public SwitchParameter IncludeEntries { get; set; }
+
+ ///
+ /// Validate the archive integrity by attempting to read all entries
+ ///
+ [Parameter]
+ public SwitchParameter ValidateIntegrity { get; set; }
+
+ ///
+ /// Filter entries by name pattern (supports wildcards)
+ ///
+ [Parameter]
+ [ValidateNotNullOrEmpty]
+ public string? Filter { get; set; }
+
+ ///
+ /// Processes the cmdlet
+ ///
+ protected override void ProcessRecord()
+ {
+ // Validate zip file exists
+ if (!ZipFile.Exists)
+ {
+ var errorRecord = new ErrorRecord(
+ new FileNotFoundException($"Zip file not found: {ZipFile.FullName}"),
+ "ZipFileNotFound",
+ ErrorCategory.ObjectNotFound,
+ ZipFile);
+ ThrowTerminatingError(errorRecord);
+ }
+
+ var archiveInfo = ExecuteOperation("ReadZipArchive", () =>
+ {
+ WriteVerboseMessage("Reading zip archive: {0}", ZipFile.FullName);
+
+ ZipArchiveInfo result;
+ using (var fileStream = ZipFile.OpenRead())
+ using (var archive = new ZipArchive(fileStream, ZipArchiveMode.Read))
+ {
+ // Create archive info
+ result = new ZipArchiveInfo
+ {
+ ZipFilePath = ZipFile.FullName,
+ ZipFileName = ZipFile.Name,
+ ZipFileSize = ZipFile.Length,
+ CreationTime = ZipFile.CreationTime,
+ LastWriteTime = ZipFile.LastWriteTime,
+ EntryCount = archive.Entries.Count
+ };
+
+ // Calculate total uncompressed size
+ result.TotalUncompressedSize = archive.Entries.Sum(e => e.Length);
+ result.TotalCompressedSize = archive.Entries.Sum(e => e.CompressedLength);
+ result.CompressionRatio = result.TotalUncompressedSize > 0
+ ? (double)result.TotalCompressedSize / result.TotalUncompressedSize
+ : 0;
+
+ WriteVerboseMessage("Archive contains {0} entries, {1} -> {2} ({3:F1}% compression)",
+ result.EntryCount,
+ SizeFormatter.FormatBytes(result.TotalUncompressedSize),
+ SizeFormatter.FormatBytes(result.TotalCompressedSize),
+ (1 - result.CompressionRatio) * 100);
+
+ // Include detailed entries if requested
+ if (IncludeEntries.IsPresent)
+ {
+ var entries = archive.Entries.AsEnumerable();
+
+ // Apply filter if specified
+ if (!string.IsNullOrEmpty(Filter))
+ {
+ var wildcardPattern = new WildcardPattern(Filter, WildcardOptions.IgnoreCase);
+ entries = entries.Where(e => wildcardPattern.IsMatch(e.FullName));
+ }
+
+ result.Entries = entries.Select(entry => new ZipEntryInfo
+ {
+ FullName = entry.FullName,
+ Name = entry.Name,
+ Length = entry.Length,
+ CompressedLength = entry.CompressedLength,
+ CompressionRatio = entry.Length > 0 ? (double)entry.CompressedLength / entry.Length : 0,
+ LastWriteTime = entry.LastWriteTime,
+ IsDirectory = string.IsNullOrEmpty(entry.Name) && entry.FullName.EndsWith("/")
+ }).ToArray();
+
+ WriteVerboseMessage("Included {0} entry details", result.Entries.Length);
+ }
+
+ // Validate integrity if requested
+ if (ValidateIntegrity.IsPresent)
+ {
+ WriteVerboseMessage("Validating archive integrity...");
+ var validationStart = DateTime.UtcNow;
+ var validEntries = 0;
+ var invalidEntries = 0;
+
+ foreach (var entry in archive.Entries)
+ {
+ try
+ {
+ using (var entryStream = entry.Open())
+ {
+ // Read a small portion to validate the entry can be opened
+ var buffer = new byte[1024];
+ entryStream.Read(buffer, 0, buffer.Length);
+ }
+ validEntries++;
+ }
+ catch (Exception ex)
+ {
+ invalidEntries++;
+ WriteWarning($"Entry '{entry.FullName}' failed validation: {ex.Message}");
+ }
+ }
+
+ var validationDuration = DateTime.UtcNow - validationStart;
+ result.IsValid = invalidEntries == 0;
+ result.ValidationDuration = validationDuration;
+
+ WriteVerboseMessage("Validation completed in {0}: {1} valid, {2} invalid entries",
+ SizeFormatter.FormatDuration(validationDuration),
+ validEntries,
+ invalidEntries);
+
+ if (invalidEntries > 0)
+ {
+ WriteWarning($"Archive validation found {invalidEntries} corrupted entries");
+ }
+ }
+ }
+
+ WriteVerboseMessage("Successfully read zip archive information");
+ return result;
+
+ }, $"ZipFile: {ZipFile.FullName}");
+
+ // Always return the archive info object
+ WriteObject(archiveInfo);
+ }
+ }
+
+ ///
+ /// Information about a zip archive
+ ///
+ public class ZipArchiveInfo
+ {
+ public string ZipFilePath { get; set; } = string.Empty;
+ public string ZipFileName { get; set; } = string.Empty;
+ public long ZipFileSize { get; set; }
+ public DateTime CreationTime { get; set; }
+ public DateTime LastWriteTime { get; set; }
+ public int EntryCount { get; set; }
+ public long TotalUncompressedSize { get; set; }
+ public long TotalCompressedSize { get; set; }
+ public double CompressionRatio { get; set; }
+ public double CompressionEfficiency => (1 - CompressionRatio) * 100;
+ public long SpaceSaved => TotalUncompressedSize - TotalCompressedSize;
+ public ZipEntryInfo[]? Entries { get; set; }
+ public bool? IsValid { get; set; }
+ public TimeSpan? ValidationDuration { get; set; }
+ }
+
+ ///
+ /// Information about a zip archive entry
+ ///
+ public class ZipEntryInfo
+ {
+ public string FullName { get; set; } = string.Empty;
+ public string Name { get; set; } = string.Empty;
+ public long Length { get; set; }
+ public long CompressedLength { get; set; }
+ public double CompressionRatio { get; set; }
+ public double CompressionEfficiency => (1 - CompressionRatio) * 100;
+ public long SpaceSaved => Length - CompressedLength;
+ public DateTimeOffset LastWriteTime { get; set; }
+ public bool IsDirectory { get; set; }
+ }
+}
diff --git a/src/Cmdlets/NewMinIOZipArchiveCmdlet.cs b/src/Cmdlets/NewMinIOZipArchiveCmdlet.cs
index a460e3c..ec9f517 100644
--- a/src/Cmdlets/NewMinIOZipArchiveCmdlet.cs
+++ b/src/Cmdlets/NewMinIOZipArchiveCmdlet.cs
@@ -17,12 +17,12 @@ namespace PSMinIO.Cmdlets
public class NewMinIOZipArchiveCmdlet : MinIOBaseCmdlet
{
///
- /// Path where the zip archive will be created
+ /// FileInfo object representing where the zip archive will be created
///
[Parameter(Position = 0, Mandatory = true)]
- [ValidateNotNullOrEmpty]
- [Alias("ZipPath", "Archive")]
- public string DestinationPath { get; set; } = string.Empty;
+ [ValidateNotNull]
+ [Alias("ZipPath", "Archive", "Destination")]
+ public FileInfo DestinationPath { get; set; } = null!;
///
/// Array of FileInfo objects to add to the zip
@@ -99,23 +99,16 @@ namespace PSMinIO.Cmdlets
[Parameter]
public SwitchParameter Force { get; set; }
- ///
- /// Return the zip creation result
- ///
- [Parameter]
- public SwitchParameter PassThru { get; set; }
-
///
/// Processes the cmdlet
///
protected override void ProcessRecord()
{
// Validate destination path
- var destinationInfo = new FileInfo(DestinationPath);
- if (destinationInfo.Exists && !Force.IsPresent)
+ if (DestinationPath.Exists && !Force.IsPresent)
{
var errorRecord = new ErrorRecord(
- new InvalidOperationException($"Zip file already exists: {DestinationPath}. Use -Force to overwrite."),
+ new InvalidOperationException($"Zip file already exists: {DestinationPath.FullName}. Use -Force to overwrite."),
"ZipFileExists",
ErrorCategory.ResourceExists,
DestinationPath);
@@ -123,10 +116,10 @@ namespace PSMinIO.Cmdlets
}
// Ensure destination directory exists
- if (destinationInfo.Directory != null && !destinationInfo.Directory.Exists)
+ if (DestinationPath.Directory != null && !DestinationPath.Directory.Exists)
{
- destinationInfo.Directory.Create();
- WriteVerboseMessage("Created destination directory: {0}", destinationInfo.Directory.FullName);
+ DestinationPath.Directory.Create();
+ WriteVerboseMessage("Created destination directory: {0}", DestinationPath.Directory.FullName);
}
// Parse compression level
@@ -141,43 +134,41 @@ namespace PSMinIO.Cmdlets
_ => "Create zip archive"
};
- if (ShouldProcess(DestinationPath, operationDescription))
+ if (ShouldProcess(DestinationPath.FullName, operationDescription))
{
- ExecuteOperation("CreateZipArchive", () =>
+ var result = ExecuteOperation("CreateZipArchive", () =>
{
- WriteVerboseMessage("Creating zip archive: {0}", DestinationPath);
+ WriteVerboseMessage("Creating zip archive: {0}", DestinationPath.FullName);
WriteVerboseMessage("Compression level: {0}, Mode: {1}", CompressionLevel, Mode);
- ZipCreationResult result;
- using (var zipBuilder = ZipBuilder.CreateFile(this, DestinationPath, archiveMode))
+ ZipCreationResult zipResult;
+ using (var zipBuilder = ZipBuilder.CreateFile(this, DestinationPath.FullName, archiveMode))
{
switch (ParameterSetName)
{
case "Files":
- result = ProcessFiles(zipBuilder, compressionLevel);
+ zipResult = ProcessFiles(zipBuilder, compressionLevel);
break;
case "Directory":
- result = ProcessDirectory(zipBuilder, compressionLevel);
+ zipResult = ProcessDirectory(zipBuilder, compressionLevel);
break;
default:
throw new InvalidOperationException($"Unknown parameter set: {ParameterSetName}");
}
}
- WriteVerboseMessage("Zip archive created successfully: {0}", DestinationPath);
+ WriteVerboseMessage("Zip archive created successfully: {0}", DestinationPath.FullName);
WriteVerboseMessage("Archive summary: {0} files, {1} -> {2} ({3:F1}% compression)",
- result.FileCount,
- SizeFormatter.FormatBytes(result.TotalUncompressedSize),
- SizeFormatter.FormatBytes(result.TotalCompressedSize),
- result.CompressionEfficiency);
+ zipResult.FileCount,
+ SizeFormatter.FormatBytes(zipResult.TotalUncompressedSize),
+ SizeFormatter.FormatBytes(zipResult.TotalCompressedSize),
+ zipResult.CompressionEfficiency);
- if (PassThru.IsPresent)
- {
- WriteObject(result);
- }
+ return zipResult;
+ }, $"Destination: {DestinationPath.FullName}, ParameterSet: {ParameterSetName}");
- return result;
- }, $"Destination: {DestinationPath}, ParameterSet: {ParameterSetName}");
+ // Always return the result object
+ WriteObject(result);
}
}
@@ -189,7 +180,7 @@ namespace PSMinIO.Cmdlets
if (Path == null || Path.Length == 0)
{
WriteWarning("No files provided for zip archive");
- return zipBuilder.CreateResult(DestinationPath);
+ return zipBuilder.CreateResult(DestinationPath.FullName);
}
// Filter out files that don't exist
@@ -204,7 +195,7 @@ namespace PSMinIO.Cmdlets
if (validFiles.Length == 0)
{
WriteWarning("No valid files found for zip archive");
- return zipBuilder.CreateResult(DestinationPath);
+ return zipBuilder.CreateResult(DestinationPath.FullName);
}
WriteVerboseMessage("Adding {0} files to zip archive", validFiles.Length);
@@ -212,7 +203,7 @@ namespace PSMinIO.Cmdlets
// Add files to zip
zipBuilder.AddFiles(validFiles.Cast(), BasePath, compressionLevel);
- return zipBuilder.CreateResult(DestinationPath);
+ return zipBuilder.CreateResult(DestinationPath.FullName);
}
///
@@ -228,7 +219,7 @@ namespace PSMinIO.Cmdlets
ErrorCategory.ObjectNotFound,
Directory);
ThrowTerminatingError(errorRecord);
- return zipBuilder.CreateResult(DestinationPath);
+ return zipBuilder.CreateResult(DestinationPath.FullName);
}
// Get files from directory
@@ -236,7 +227,7 @@ namespace PSMinIO.Cmdlets
if (files.Length == 0)
{
WriteWarning($"No files found in directory: {Directory.FullName}");
- return zipBuilder.CreateResult(DestinationPath);
+ return zipBuilder.CreateResult(DestinationPath.FullName);
}
WriteVerboseMessage("Adding directory to zip: {0} ({1} files)", Directory.Name, files.Length);
@@ -247,7 +238,7 @@ namespace PSMinIO.Cmdlets
// Add files to zip
zipBuilder.AddFiles(files.Cast(), basePath, compressionLevel);
- return zipBuilder.CreateResult(DestinationPath);
+ return zipBuilder.CreateResult(DestinationPath.FullName);
}
///