Skip to main content

In my workspace, I have an FTPCaller Transformer that uploads (copies) files from a folder to an ftp site.

 

Next step is I want to delete all the pdf files in the source folder from where all the pdf files were copied to the ftp site. I have tried attaching this solution (File Copy - DELETE (safe.com)) after the FTPCaller but the files are not deleted, besides it seems to only delete a single named file. Does not seem to handle wildcards like *.pdf.

 

I also tried FileDeleter FME Hub (safe.com) and it not only did not delete the files, but I was reading it does not work in FME Flow, and I plan to upload my workspace to FME Flow and run it on an incremental schedule.

 

Should I create a separate workspace that just deletes all the pdf files in the folder and run it after the files are copied to the ftp site?

 

In essence, what is the best way to delete *.pdf files in a folder?

 

 

If you only need the PDF files inside the workspace, there is no need to write them to disk.

Instead you can use a TempPathnameCreator to provide a path to temporarily store the PDF files. FME will automatically delete the PDF files at the end of the workspace.

 

 


If you only need the PDF files inside the workspace, there is no need to write them to disk.

Instead you can use a TempPathnameCreator to provide a path to temporarily store the PDF files. FME will automatically delete the PDF files at the end of the workspace.

 

 

This. But if you really need to delete files you can always use a SystemCaller and use something like

del c:\temp\*.pdf

or use the PythonCaller if you are more familiar with Python.

 

I must admit that using the SystemCaller to delete files with a workbench on server scares me a bit, especially using wildcards. I had some nasty experiences with unexpected input for the systemcaller resulting in more deleted files than I had anticipated. But it can be done.


Thanks for the help. I did manage to get FileDeleter to work in FME Form and it works in FME Flow as well. I have the answer I need, but more curious as why I could not get the SystemCaller to work...

 

I tried SystemCaller using this parameter:

SystemCaller_del_parameter_failed_to_execute 

But it did not delete the files and the log message is:

SystemCaller: Failed to Execute `del \\\\myservermachine\\Z_shared\\FME Workflow\\Reports to FTP\\*.pdf'

 

Any suggestions on how I can modify the SystemCaller parameter to delete the files?


Thanks for the help. I did manage to get FileDeleter to work in FME Form and it works in FME Flow as well. I have the answer I need, but more curious as why I could not get the SystemCaller to work...

 

I tried SystemCaller using this parameter:

SystemCaller_del_parameter_failed_to_execute 

But it did not delete the files and the log message is:

SystemCaller: Failed to Execute `del \\\\myservermachine\\Z_shared\\FME Workflow\\Reports to FTP\\*.pdf'

 

Any suggestions on how I can modify the SystemCaller parameter to delete the files?

Hey Tim,

My best guess would be the UNC path (network drive) isn't being accepted by the SystemCaller. If you try the same command in Command Prompt, does it work?

Does the del command work when you try deleting a file on your local hard drive?

I was able to get the del command to work when specifying a wildcard in a network drive, so it is possible.


Reply