Question

Issue with filecopy writer in FME workbench 2023.1- previously fine in FME workbench 2020.2

  • 12 January 2024
  • 3 replies
  • 6 views

Badge

Hi everyone,

 

I have a some workspaces in workbench 2020.02, where I have used Creator and the filecopy writer to create new empty folders at the start of the translation. However, this no longer works in workbench 2023.1. Is this function no longer supported with filecopy?

 

Thanks! 🙂

 

 Filecopy_FME2020 Filecopy_FME2023


3 replies

Userlevel 3
Badge +26

Do you have a sample workspace you could upload for reference?

Badge

Hi @dustin​ Thanks for your reply. I haven't added a sample workspace, but this one can be fast to test since it's just the Creator + filecopy writer. I've just edited my question to add the screenshots. The 2020 example creates a folder, the 2023 example doesn't! Are you experiencing the same outcome?

 

 

Userlevel 3
Badge +26

Hi @dustin​ Thanks for your reply. I haven't added a sample workspace, but this one can be fast to test since it's just the Creator + filecopy writer. I've just edited my question to add the screenshots. The 2020 example creates a folder, the 2023 example doesn't! Are you experiencing the same outcome?

 

 

I haven't experienced that issue with the FileCopy writer, but I normally will use a PythonCaller or PythonCreator to accomplish that task. The code below will create a new directory (copy/paste into PythonCreator). You'll just need to update the new_dir parameter with the path you want. 

import fmeobjects
import os
 
 
class FeatureCreator(object):
    """Template Class Interface:
    When using this class, make sure its name is set as the value of the 'Class
    to Process Features' transformer parameter.
    """
    
    def __init__(self):
        """Base constructor for class members."""
        pass
        
    def input(self, feature):
        """This method is called once by FME to create FME Feature(s).
        A created Feature is emitted through the self.pyoutput() method.
        Any number of Features can be created and emitted by this method.
        
        :param fmeobjects.FMEFeature feature: Dummy FME Feature passed in by
            FME. It can be ignored.
        """
        new_dir = "E:\your_path"
        
        if not os.path.exists(new_dir):
            os.mkdir(new_dir)
        
        newFeature = fmeobjects.FMEFeature()
        self.pyoutput(newFeature)
        
    def close(self):
        """This method is called at the end of the class."""
        pass

 

Reply