Hi,
Â
Â
I don't think there is such a transformer.
Â
FME itself has a functionality to delete automatically temp files after completion of a translation. And I don't think that the size of temp files affects so much to performance of the translation, unless overflowing disk size.
Â
So I don't worry about that.
Â
Â
This article may be helpful.
Â
Why did the temporary files not get deleted from my translation? (
http://fmepedia.safe.com/articles/FAQ/Why-did-the-temporary-files-not-get-deleted-from-my-translation)
Â
Â
Takashi
there is a manual purg button on the menu of Workbench.
Â
Tools->purge. But there is no automated option afaik.
This is a shutdown script example to try removing all the temporary files and folders in the FME_TEMP folder.
Â
I cannot guarantee that it always works safely.
Â
-----
Â
# Shutdown Python Script Example
Â
import os
Â
Â
# Try removing a file/directory specified by the path.
Â
# If the path indicates a directory, it removes recursively
Â
# all subdirectories and files under the directory.
Â
def rmfile(path):
Â
  if os.path.isfile(path):
Â
    try:
Â
      os.remove(path)
Â
    except:
Â
      pass
Â
  else:
Â
    map(rmfile, Â'%s/%s' % (path, f) for f in os.listdir(path)])
Â
    try:
Â
      os.rmdir(path)
Â
    except:
Â
      pass
Â
Â
# Get FME_TEMP directory path from environment variable.
Â
# If it exists, try removing all temporary files and folders.
Â
tmp = os.environ.get('FME_TEMP')
Â
if tmp != None:
Â
  map(rmfile, n'%s/%s' % (tmp, f) for f  in os.listdir(tmp)])
Â
-----
Â
Â
Tcl too can do that concisely.
Â
-----
Â
# Shutdown Tcl Script Example
Â
proc rmfile {path} {
Â
  if {
     foreach f mglob -directory $path -type {f d} *] {rmfile $f}Â
  }Â
  catch {file delete $path}Â
}Â
Â
if {!{catch {set tmp $env(FME_TEMP)}]} {Â
  foreach f eglob -directory $tmp -type {f d} *] {rmfile $f}Â
}Â
-----
The shutdown script certainly removes every unlocked file in the Temp folder, including temporary source files for Views of Data Inspector. So the Views showing translation results may become invalid immediately after running the script.
Â
That's a side-effect. If you cannot accept it, the script should not be used.