Question

Can you read from a .zip folder that contains only one file ?

  • 19 April 2017
  • 7 replies
  • 9 views

Badge +3

Hello FME-community,

I have a peculiar situation in which I need to read files inside a .zip-file, and the .zip-file contains only one .fmw-file.

I want to do this in a dynamical way, so I make use of the FeatureReader transformer to read the files.

Reading from a .zip-file works if the .zip-file contains at least 2 different files. It fails however if the file-file contains only one file or two files with an identical extension.

Is it possible to read (Directory and File Pathnames) from a .zip-file that contains only one file inside it?

Kind regards,

Dries


7 replies

Userlevel 2
Badge +12

Should be no problem.

Have you turned on the "Merge" option?

That would be necessary for some reader formats to read all files.

Badge +3

Should be no problem.

Have you turned on the "Merge" option?

That would be necessary for some reader formats to read all files.

Hi erik_jan,

 

Thank you for the answer. The "Merge" option, to merge attributes from the incoming feature with attributes from the resulting features, is enabled in the FeatureReader transformer.

Userlevel 2
Badge +12

This example uses a ZIP file with one CSV file included:

These are the settings I used for the FeatureReader:

Badge +3

This example uses a ZIP file with one CSV file included:

These are the settings I used for the FeatureReader:

Thank you again for your answer, but it does not work for reader type "Directory and File Pathnames".

 

 

Userlevel 2
Badge +17
Thank you again for your answer, but it does not work for reader type "Directory and File Pathnames".

 

 

Hi @verdoodtdries, If you try adding a Directory and File Pathnames (PATH) reader with setting a zip file path to the Dataset field through the Add Reader dialog, Workbench rejects to add the PATH reader to the workspace and pops a warning message like this.

 

Therefore I'm afraid that it's NOT intended that the PATH reader supports reading the information of file(s) archived in a zip file, even if it actually worked on a zip file containing two or more files.

 

Badge

@erik_jan, @verdoodtdries,

This is indeed a problem, but it specifically occurs when using the reader format 'Directory and File Pathnames' in the FeatureReader. Formats like excel, csv, dwg, etc. works fine.

 

 

When you put e.g. an empty .txt file in the zip package (so the package contains 2 files) the 'Directory and File Pathames' does work.

 

 

What would be the reason?

Badge +3

@erik_jan, @verdoodtdries,

This is indeed a problem, but it specifically occurs when using the reader format 'Directory and File Pathnames' in the FeatureReader. Formats like excel, csv, dwg, etc. works fine.

 

 

When you put e.g. an empty .txt file in the zip package (so the package contains 2 files) the 'Directory and File Pathames' does work.

 

 

What would be the reason?

jneujens,

 

Adding an extra, empty, txt-file to the zip solved this issue. Thank you for the suggestion of this workaround!

 

Reply