To delete a directory tree recursively, you can use the following in a PythonCaller:
import shutil
import fmeobjects
def delete_directories(feature):
directory_to_delete = feature.getAttribute('directory_to_delete')
if directory_to_delete:
shutil.rmtree(directory_to_delete)
You will have to provide a single feature with an attribute "directory_to_delete" containing the root of the folder structure to delete.
Example if you send a feature with the following attribute:
directory_to_delete = 'c:\output\temp123'
This will permanently delete ALL the files and subdirectories from c:\output\temp123 and down. Notice that the deleted files will NOT go to the recycle bin, they will be deleted for good. See also the documentation for rmtree.
NOTE: I assume no responsability whatsoever for the use or abuse of the above code! Be careful, you're on your own if something important gets deleted!