I have a simple process that downloads a file from an FTP site and unzips the contents to a folder. Unfortunately the date of the file once unzipped is recorded as the date when the fmw was run but I need to get the date of the file itself. Is this possible?

The process enter image description here

The result

enter image description here

But looking at the zip file we see the date that we need. enter image description here

I noticed the zip extractor has a _creation_instance can this be captured into a variable (assuming it is the date we need)?

Is there a parameter in the ZipExtractor (or other plugins) that allows me to capture the date of the files within it?

UPDATE: Based on the responses I tried the following but the powershell doesn't run from FME and without it I get the wrong date values. enter image description here

  • 1
    I would have a look at using a PythonCaller and using Python to extract the dates of the files. You can possibly use the zipfile module and extract the dates from the archive members using zipinfo. _creation_instance comes from your Creator transformer. – Fezter Aug 31 '20 at 0:15
  • 1
    filepropertyextractor (fme hub) does this hub.safe.com/publishers/pacific-spatial-solutions/transformers/… (use "_file_ctime" aka creation date) – Mapperz Aug 31 '20 at 0:53
  • @Mapperz this works if we use powershell to unzip the files but if we use any of the FME unizp modules it has _file_mtime/ctime as the current date. I tried a SystemCaller with powershell.exe -nologo -noprofile -command "& { Add-Type -A 'System.IO.Compressio n.FileSystem'; [IO.Compression.ZipFile]::ExtractToDirectory("J:\Property Update FME Model\Input\RC.zip", "J:\Property Update FME Model\Input\RC"); }" but it doesn't run (i tried connecting it to a Creator as well. – GeorgeC Aug 31 '20 at 1:06
  • 2
    I believe the unzipping in fme extracts to a temp folder as hub.safe.com/publishers/safe-lab/transformers/unzipper does - would contact safe support they will get you a support answer – Mapperz Aug 31 '20 at 3:44
  • 1
    I have reported the date issue as a support ticket and also worked out the problem with powershell -needed ' and not " to specify the zip source and out folders. – GeorgeC Aug 31 '20 at 5:09

Based on the 2 replies I have worked out a solution by bypassing the FME unzipper and reported the issue to FME and the publisher.

Basically I use powershell from a system caller and then filepropertyextractor.

enter image description here

SystemCaller is powershell.exe -nologo -noprofile -command "& { Add-Type -A 'System.IO.Compression.FileSystem'; [IO.Compression.ZipFile]::ExtractToDirectory('J:\Property Update FME Model\Input\RC.zip', 'J:\Property Update FME Model\Input\RC'); }"

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.