So, even if we pass -Force to Get-ChildItem to get the paths of hidden file objects to pass to Compress-Archive, internally the cmdlet is fetching those file objects again using Get-Item.but it's not passing -Force, which of course will fail (despite what the comment on the previous line claims). $currentArchiveEntry.LastWriteTime = (Get-Item -LiteralPath $currentFilePath).LastWriteTime # At this point we are sure that Get-ChildItem would succeed. # Updating the File Creation time so that the same timestamp would be retained after expanding the compressed file. Compressing files makes them smaller in size. Enterprise customers can use PKZIP’s policy manager to standardize compression activities according to organizational policies and best practices, helping maximize efficiency, system performance, and resource savings.
Compress zip files archive#
On my system, the referenced lines 812-814 of 1 are. When you download an export, it may be a compressed file, commonly known as a ZIP. Users can compress files in several archive formats, including ZIP, TAR, BZ2, and many others. (Note that invoking the first snippet without Select-Object -ExpandProperty 'FullName' instead throws Compress-Archive : The path '.' either does not exist or is not a valid file system path.) for the first hidden file in the input list. + FullyQualifiedErrorId : ExceptionWhenSetting + CategoryInfo : NotSpecified: (:), SetValueInvocationException
$currentArchiveEntry.LastWriteTime = (Get-Item -LiteralPa. You have a couple options to choose from here. Right click in the highlighted area and the WinZip submenu will appear.
+ FullyQualifiedErrorId : ItemNotFound,Įxception setting "LastWriteTime": "Cannot convert null to type "System.DateTimeOffset"."Īt C:\WINDOWS\system32\WindowsPowerShell\v1.0\Modules\\1:814 char:25 Compressing large files outside of WinZip (you need WinZip installed for this to work) Open a folder containing all the files you wish to compress. + CategoryInfo : ObjectNotFound: (.:String), IOException Entry.LastWriteTime = (Get-Item -LiteralPath $currentFilePath).LastWr. Both of those invocations, however, throw these errors. to work as a way of passing hidden files to the cmdlet the key being specifying the -Force parameter for Get-ChildItem. Get-ChildItem -Path '.' -Force | Compress-Archive -DestinationPath '.' | Select-Object -ExpandProperty 'FullName' ` Since the cmdlet provides no "include hidden files" parameter but does accept a collection of source files via the -Path or -LiteralPath parameters, I would expect either this. This looks like a bug/oversight in the Compress-Archive cmdlet.