Overwritting .shp files gives mixed results so my workaround is to delete the .shp file(s) first and then create the new version. But I can not figure out how to do that --I read somewhere that writers have a ‘delete’ setting for the ‘fme_db_operation’ parameter but I can not locate that anywhere. Can anybody tell me if FME has the ability to delete the .shp files in a folder? Thanks! Lewis
Assuming Windows based system, with SystemCaller , use command line
Del “<shp_file_folder>\<shp_file_name>.* “
(with general use case assumption there will be no other unrelated files with a different extension by the same name)
https://learn.microsoft.com/en-us/windows-server/administration/windows-commands/del
You can retrieve and manipulate the list of files to target for deletion as 1 file per Feature with a File/Folder Reader, filter these with Eg. A Tester and pass each of the target shape files as input Features to SystemCaller to run the Del(ete) command line against.
The fme_db_operation attribute, typically output by a ChangeDetector, is not for file deletion. As implied in the name, it is a database operation on rows/records within a database table being written to, being INSERT, UPDATE, DELETE or UPSERT for where the use case is to only write delta changes to the database table rather than an alternative writing mode that completely drops, deletes all rows or truncates the table and fully rewrite it.
I often use the filecopy writer to remove files
https://docs.safe.com/fme/html/FME-Form-Documentation/FME-ReadersWriters/filecopy/filecopy.htm
first create a temp folder with the tempPathnameCreator
and move the files to that folder using the filecopier
Systemcaller works well too, but had troubles before getting this deployed to different environments. Using the temppathnamecreator + filecopier only uses FME
Thank you for these suggestions -- the System Caller instructions worked really well for me and I was able to delete one or multiple files from a folder. The FileCopy is also useful. Thank you very much for you help! Lewis