Microsoft.PowerShell.Archive icon indicating copy to clipboard operation
Microsoft.PowerShell.Archive copied to clipboard

Compress-Archive should support compressing hidden files

Open jtmoon79 opened this issue 1 year ago • 2 comments

Summary of the new feature / enhancement

Currently Compress-Archive fails to compress hidden files. So for example, Compress-Archive -Path C:\My-Git-Repo will not compress the directory .git which is a directory with NTFS attribute hidden. Users must come up with various workarounds for this problem.

Users should be able to include NTFS hidden files and directories in the archive.

Proposed technical implementation details (optional)

Add a parameter switch like -Hidden or -IncludeHidden that will cause Compress-Archive to include all hidden files and directories under the -Path within the final archive file.

jtmoon79 avatar Jan 24 '24 00:01 jtmoon79

Whoops, looks like this is implemented in https://github.com/PowerShell/Microsoft.PowerShell.Archive/issues/66 I don't see any autolinks from that Issue into this Powershell project so I wonder if the fix is included in any Powershell release. Maybe that Microsoft.PowerShell.Archive could be included in an upcoming Powershell release?

jtmoon79 avatar Jan 24 '24 00:01 jtmoon79

@jtmoon79, as of PowerShell 7.5.0-preview.1 / 7.4.1, the bundled version of the module is 1.2.5

It would certainly be good to know in what PowerShell version the fix will land, but it will likely first become available as a NuGet package you can install on demand (a preview version is available, but the package was later unlisted). See my comment on the linked issue.

mklement0 avatar Jan 24 '24 15:01 mklement0