I want my workspace to clean up after itself. It creates a number of files in a temporary location, which is specified in a parameter: FANOUT_DIRECTORY], which points to:
C:\\TempData\\translation_temp
Using FME 2014, I want to get python to delete all fines within this.
In theory, I need something like this:
#remove the text files
import os;
def FeatureProcessor(feature):
folder = str(FME_MacroValues_'FANOUT_DIRECTORY'])
for the_file in os.listdir(folder):
file_path = os.path.join(folder, the_file)
try:
if os.path.isfile(file_path):
os.unlink(file_path)
except Exception, e:
print e
However, the value for "folder" when it gets the parameter FANOUT_DIRECTORY is:
C:<backslash>TempData<backslash>translation_temp
Which is obviously wrong. Anyone know how to get a parameter properly such that I can just use it? The examples I've seen don't appear to have this problem (but Python-FME documentation is sparse and conflicting).
Thanks.