Skip to main content

Hi I have a number of zip files. I would like to extract these and copy only specific ones to a folder. The list of required files is in a text file.

Any idea of the best way to achieve this

Hi @sunsilk11​ 

 

The custom transformer ZipExtractor can be used for extract zip files. You can use the transformer FeatureMerger to get the same names from files ( zipfiles * tex files ).

By last the Writer FileCopy to copy.

 

Thanks in Advance,

Danilo


The TempPathnameCreator is very helpful if you prefer to unzip the entire contents before copying only the desired files to the target directory. Folders created by the TempPathnameCreator are automatically deleted when FME terminates.


The TempPathnameCreator is very helpful if you prefer to unzip the entire contents before copying only the desired files to the target directory. Folders created by the TempPathnameCreator are automatically deleted when FME terminates.

Thanks. I need to extract files from a dozen zip files. Would I need 12 zipExtractor for this or is there a more efficient way?


Thanks. I need to extract files from a dozen zip files. Would I need 12 zipExtractor for this or is there a more efficient way?

Unless the zip files are enormous, I would do as follows:

  1. Create a temp directory with the TempPathnameCreator
  2. Unzip everything to the temp dir (ZipExtractor from the FME Hub)
  3. On the "Files" output port, connect a FilenamePartExtractor
  4. Use the result in a FeatureMerger to with list of files to keep (see answer from @danilo_fme​ )
  5. For each file to keep, use the File Copy write to copy the file to the target directory

Reply