Skip to main content
Question

create empty folder in zip file


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

 

4 replies

Forum|alt.badge.img+2

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
  • May 18, 2020
jlbaker2779 wrote:

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
zzupljanin wrote:

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
  • May 20, 2020
jlbaker2779 wrote:

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


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings