Empty folders are not included in a ZIP archive
See original GitHub issueWhat You Are Seeing?
I’m trying to create a ZIP archive with pre-defined folder structure. Some folders are empty. After using Zip("./Package", "Package.zip");
, I see that Package.zip is created, but when I look inside it, there are no empty folders. Only folders with files are included.
What is Expected?
I expect empty folders to be present in the ZIP archive.
What version of Cake are you using?
0.16.2.
Are you running on a 32 or 64 bit system?
64-bit.
What environment are you running on? Windows? Linux? Mac?
- Windows 10 (1511).
- Ubuntu 16.04.1.
Are you running on a CI Server? If so, which one?
No.
How Did You Get This To Happen? (Steps to Reproduce)
Create the following folder structure:
+ Package
| + Empty
| + NotEmpty
| | - File.txt
In the build.cake
perform Zip("./Package", "Package.zip");
.
Output Log
Feeds used:
/home/havok/.local/share/NuGet/Cache
/home/havok/.nuget/packages/
https://api.nuget.org/v3/index.json
All packages listed in /home/havok/Projects/Cake/ZipEmptyFolders/tools/packages.config are already installed.
Module directory does not exist.
Analyzing build script...
Analyzing /home/havok/Projects/Cake/ZipEmptyFolders/build.cake...
Processing build script...
Creating script session...
Adding reference to Cake.Core.dll...
Adding reference to Cake.Common.dll...
Adding reference to Cake.exe...
Adding reference to System.Xml.dll...
Adding reference to System.Xml.Linq.dll...
Adding reference to System.Data.dll...
Importing namespace Cake.Common...
Importing namespace Cake.Common.Build...
Importing namespace Cake.Common.Build.AppVeyor...
Importing namespace Cake.Common.Build.AppVeyor.Data...
Importing namespace Cake.Common.Build.BitbucketPipelines...
Importing namespace Cake.Common.Build.BitbucketPipelines.Data...
Importing namespace Cake.Common.Build.Bitrise...
Importing namespace Cake.Common.Build.Bitrise.Data...
Importing namespace Cake.Common.Build.ContinuaCI...
Importing namespace Cake.Common.Build.ContinuaCI.Data...
Importing namespace Cake.Common.Build.Jenkins...
Importing namespace Cake.Common.Build.Jenkins.Data...
Importing namespace Cake.Common.Build.TravisCI...
Importing namespace Cake.Common.Build.TravisCI.Data...
Importing namespace Cake.Common.Diagnostics...
Importing namespace Cake.Common.IO...
Importing namespace Cake.Common.IO.Paths...
Importing namespace Cake.Common.Net...
Importing namespace Cake.Common.Security...
Importing namespace Cake.Common.Solution...
Importing namespace Cake.Common.Solution.Project...
Importing namespace Cake.Common.Solution.Project.Properties...
Importing namespace Cake.Common.Solution.Project.XmlDoc...
Importing namespace Cake.Common.Text...
Importing namespace Cake.Common.Tools...
Importing namespace Cake.Common.Tools.Cake...
Importing namespace Cake.Common.Tools.Chocolatey...
Importing namespace Cake.Common.Tools.Chocolatey.ApiKey...
Importing namespace Cake.Common.Tools.Chocolatey.Config...
Importing namespace Cake.Common.Tools.Chocolatey.Features...
Importing namespace Cake.Common.Tools.Chocolatey.Install...
Importing namespace Cake.Common.Tools.Chocolatey.Pack...
Importing namespace Cake.Common.Tools.Chocolatey.Pin...
Importing namespace Cake.Common.Tools.Chocolatey.Push...
Importing namespace Cake.Common.Tools.Chocolatey.Sources...
Importing namespace Cake.Common.Tools.Chocolatey.Upgrade...
Importing namespace Cake.Common.Tools.DNU...
Importing namespace Cake.Common.Tools.DNU.Build...
Importing namespace Cake.Common.Tools.DNU.Pack...
Importing namespace Cake.Common.Tools.DNU.Restore...
Importing namespace Cake.Common.Tools.DotCover...
Importing namespace Cake.Common.Tools.DotCover.Analyse...
Importing namespace Cake.Common.Tools.DotCover.Cover...
Importing namespace Cake.Common.Tools.DotNetCore...
Importing namespace Cake.Common.Tools.DotNetCore.Build...
Importing namespace Cake.Common.Tools.DotNetCore.Execute...
Importing namespace Cake.Common.Tools.DotNetCore.Pack...
Importing namespace Cake.Common.Tools.DotNetCore.Publish...
Importing namespace Cake.Common.Tools.DotNetCore.Restore...
Importing namespace Cake.Common.Tools.DotNetCore.Run...
Importing namespace Cake.Common.Tools.DotNetCore.Test...
Importing namespace Cake.Common.Tools.DupFinder...
Importing namespace Cake.Common.Tools.Fixie...
Importing namespace Cake.Common.Tools.GitLink...
Importing namespace Cake.Common.Tools.GitReleaseManager...
Importing namespace Cake.Common.Tools.GitReleaseManager.AddAssets...
Importing namespace Cake.Common.Tools.GitReleaseManager.Close...
Importing namespace Cake.Common.Tools.GitReleaseManager.Create...
Importing namespace Cake.Common.Tools.GitReleaseManager.Export...
Importing namespace Cake.Common.Tools.GitReleaseManager.Publish...
Importing namespace Cake.Common.Tools.GitReleaseNotes...
Importing namespace Cake.Common.Tools.GitVersion...
Importing namespace Cake.Common.Tools.ILMerge...
Importing namespace Cake.Common.Tools.ILRepack...
Importing namespace Cake.Common.Tools.InspectCode...
Importing namespace Cake.Common.Tools.MSBuild...
Importing namespace Cake.Common.Tools.MSTest...
Importing namespace Cake.Common.Tools.NSIS...
Importing namespace Cake.Common.Tools.NuGet...
Importing namespace Cake.Common.Tools.NuGet.Install...
Importing namespace Cake.Common.Tools.NuGet.Pack...
Importing namespace Cake.Common.Tools.NuGet.Push...
Importing namespace Cake.Common.Tools.NuGet.Restore...
Importing namespace Cake.Common.Tools.NuGet.SetApiKey...
Importing namespace Cake.Common.Tools.NuGet.SetProxy...
Importing namespace Cake.Common.Tools.NuGet.Sources...
Importing namespace Cake.Common.Tools.NuGet.Update...
Importing namespace Cake.Common.Tools.NUnit...
Importing namespace Cake.Common.Tools.OctopusDeploy...
Importing namespace Cake.Common.Tools.OpenCover...
Importing namespace Cake.Common.Tools.ReportGenerator...
Importing namespace Cake.Common.Tools.ReportUnit...
Importing namespace Cake.Common.Tools.Roundhouse...
Importing namespace Cake.Common.Tools.SignTool...
Importing namespace Cake.Common.Tools.SpecFlow...
Importing namespace Cake.Common.Tools.SpecFlow.StepDefinitionReport...
Importing namespace Cake.Common.Tools.SpecFlow.TestExecutionReport...
Importing namespace Cake.Common.Tools.TextTransform...
Importing namespace Cake.Common.Tools.VSTest...
Importing namespace Cake.Common.Tools.WiX...
Importing namespace Cake.Common.Tools.WiX.Heat...
Importing namespace Cake.Common.Tools.XBuild...
Importing namespace Cake.Common.Tools.XUnit...
Importing namespace Cake.Common.Xml...
Importing namespace Cake.Core...
Importing namespace Cake.Core.Diagnostics...
Importing namespace Cake.Core.IO...
Importing namespace Cake.Core.Scripting...
Importing namespace System...
Importing namespace System.Collections.Generic...
Importing namespace System.IO...
Importing namespace System.Linq...
Importing namespace System.Text...
Importing namespace System.Threading.Tasks...
Compiling build script...
========================================
Default
========================================
Executing task: Default
Creating zip file: /home/havok/Projects/Cake/ZipEmptyFolders/EmptyFolders.zip
Compressing file /home/havok/Projects/Cake/ZipEmptyFolders/Package/NotEmpty/File.txt
Zip successfully created: /home/havok/Projects/Cake/ZipEmptyFolders/EmptyFolders.zip
Finished executing task: Default
Task Duration
--------------------------------------------------
Default 00:00:00.0924718
--------------------------------------------------
Total: 00:00:00.0924718
Issue Analytics
- State:
- Created 7 years ago
- Comments:13 (8 by maintainers)
Top Results From Across the Web
Empty Folders No Longer Included in Zip File in Windows ...
Empty folders are automatically deleted when including it to a zip file. For us to have it back, we suggest that you share...
Read more >Empty Folders in Zip File
I've observed that empty folders are no longer included in a Zip File that is created by the Windows 10 compression option.
Read more >Include empty directories in zip file with Linux
I'm trying to zip a directory a linux using the following command: zip -r file.zip . This works, but it isn't include the...
Read more >Problems creating zip files containing empty folders
The empty folder has to be one of multiple files or folders selected to cause the described symptoms.
Read more >Powershell Compress-Archive include empty directories
Confirming that I have the same problem. Zipping empty folders in Powershell results in no file, and frustratingly no error returned. In my...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
We just call out to the 7zip binary to compress as all the other options aren’t very good. You’d need to extend this to be cross-platform, but for Windows something like this should work:
As the issue is in the .NET framework I’m going to go ahead and close this issue. Big thanks for your input and research on the issue.