Skip to main content
Question

create empty folder in zip file

  • May 15, 2020
  • 4 replies
  • 446 views

zzupljanin
Contributor
Forum|alt.badge.img+4

Hi,

 

I'd like to create an empty folder in zip file that my files are going to be written.

 

zip file location is defined as published parameter and used as prefixed parameter of every writers destination parameter, e.g. $(zipfile_location)\\lines.gml AND $(zipfile_location)\\data.dwg)

 

Cheers,

 

Želimir

 

This post is closed to further activity.
It may be an old question, an answered question, an implemented idea, or a notification-only post.
Please check post dates before relying on any information in a question or answer.
For follow-up or related questions, please post a new question or idea.
If there is a genuine update to be made, please contact us and request that the post is reopened.

4 replies

Forum|alt.badge.img+2
  • 194 replies
  • May 15, 2020

You can do a post process using 7zip (https://www.7-zip.org/ ). It will give you far greater control over the end result.

 

7zip command line to add everything in a folder including empty directories to a zip file.

7z a -tzip -mx1 -spf2 {filename}

zzupljanin
Contributor
Forum|alt.badge.img+4
  • Author
  • Contributor
  • 120 replies
  • May 18, 2020

You can do a post process using 7zip (https://www.7-zip.org/ ). It will give you far greater control over the end result.

 

7zip command line to add everything in a folder including empty directories to a zip file.

7z a -tzip -mx1 -spf2 {filename}

I don't understand. Let me try to re-explain.

 

I create a zip file with data called data.zip. Inside are gmls, dwgs... whatever.

I'd like to add an empty folder called Style in data.zip.


Forum|alt.badge.img+2
  • 194 replies
  • May 18, 2020

I don't understand. Let me try to re-explain.

 

I create a zip file with data called data.zip. Inside are gmls, dwgs... whatever.

I'd like to add an empty folder called Style in data.zip.

Here's the workflow I follow when I need to include a folder structure in a zip.

 

Create a batch file;

1. Execute the workbench

2. Create empty directories

3. Zip

4. Remove empty directories

 

Example batch file run.bat

fme C:\_Fme_Help\empty\empty.fmw
md C:\_Fme_Help\empty\Data\Empty_Folder_1
md C:\_Fme_Help\empty\Data\Empty_Folder_2
md C:\_Fme_Help\empty\Data\Empty_Folder_3
md C:\_Fme_Help\empty\Data\Empty_Folder_nth
7z a -tzip -mx1 c:\_fme_help\empty\test.zip C:\_Fme_Help\empty\Data
rd C:\_Fme_Help\empty\Data\Empty_Folder_1
rd C:\_Fme_Help\empty\Data\Empty_Folder_2
rd C:\_Fme_Help\empty\Data\Empty_Folder_3
rd C:\_Fme_Help\empty\Data\Empty_Folder_nth

 

Results are a zip file including the empty folders

0684Q00000ArN9XQAV.png

 

Other zip programs can add empty folders but 7z is the best for command line. 


zzupljanin
Contributor
Forum|alt.badge.img+4
  • Author
  • Contributor
  • 120 replies
  • May 20, 2020

Here's the workflow I follow when I need to include a folder structure in a zip.

 

Create a batch file;

1. Execute the workbench

2. Create empty directories

3. Zip

4. Remove empty directories

 

Example batch file run.bat

fme C:\_Fme_Help\empty\empty.fmw
md C:\_Fme_Help\empty\Data\Empty_Folder_1
md C:\_Fme_Help\empty\Data\Empty_Folder_2
md C:\_Fme_Help\empty\Data\Empty_Folder_3
md C:\_Fme_Help\empty\Data\Empty_Folder_nth
7z a -tzip -mx1 c:\_fme_help\empty\test.zip C:\_Fme_Help\empty\Data
rd C:\_Fme_Help\empty\Data\Empty_Folder_1
rd C:\_Fme_Help\empty\Data\Empty_Folder_2
rd C:\_Fme_Help\empty\Data\Empty_Folder_3
rd C:\_Fme_Help\empty\Data\Empty_Folder_nth

 

Results are a zip file including the empty folders

0684Q00000ArN9XQAV.png

 

Other zip programs can add empty folders but 7z is the best for command line. 

This will work for now. I applied a Python shutdown script that basically does what you suggested.

 

Thank you