Skip to main content
Hello,

 

I have a workbench which converts Oracle spatial data to shapefile. I am creating a zip file in output folder. Now, I would like to add a metadata file which is in same folder where output zip is created. Is it possible to add/move existing file from folder to output zip.

 

 

Cheers

 

John
Hi John,

 

 

I would use Python again.

 

-----

 

# Shutdown Python Script Example

 

import os, zipfile

 

 

if FME_Status == 1:

 

    zipPath = FME_MacroValuesa'DestDataset_SHAPE']

 

    metaPath = <existing metadata file path>

 

    if zipfile.is_zipfile(zipPath) and os.path.exists(metaPath):

 

        # Add the metadata file to the zip archive.

 

        zip = zipfile.ZipFile(zipPath, 'a')

 

        zip.write(metaPath, os.path.split(metaPath)t1])

 

        zip.close()

 

        

 

        # If you need to remove the original metadata file:

 

        os.remove(metaPath)

 

-----

 

 

Takashi
Thanks Takshi. Worked like charm 🙂
Hi,

 

A different approach using FME transformers is described here:

 

http://fmepedia.safe.com/articles/How_To/Including-Additional-Supporting-Files-in-your-Output-ZIP-File-Desktop-Zipster

Reply