October 18, 201411 yr After importing records from a .csv file into FM 13 Advanced, is there any way I can set the script to delete the .csv? Here's my situation. I am exporting data from an accounting system to a .csv file that "appends" with fresh data until the user decides to run an import script in FM13. If the .csv file doesn't get deleted (or emptied of records) after the import into FM13, the accounting system export will just keep appending records into it and the import will be importing duplicate records into FM. Any ideas or is this impossible to do via a script? Thanks in advance.
October 18, 201411 yr Strictly speaking the answer is no, Filemaker cannot manipulate the OS file system. However: You can delete a file with a known path by exporting an empty found set using the same path. Alternatively, use the Export Field Contents[] script step, but do not specify a field to export; In your case, you could keep an empty .csv file in a container field and export that, overwriting the existing file; Another option is to use OS-level scripting to delete the file; Finally, there are several plugins that will allow you to access the OS-file system directly. If the .csv file doesn't get deleted (or emptied of records) after the import into FM13, the accounting system export will just keep appending records into it and the import will be importing duplicate records into FM. If the records contain some unique identifier, you should be able to prevent that. -- P.S. Please update your profile to reflect your current version and OS.
October 18, 201411 yr Author Thanks so much, the Export Field Contents worked perfectly. I really appreciate the help, and I did update my profile.
October 18, 201411 yr Another option is to use OS-level scripting to delete the file; To expand on that, it's fairly easy to to do for these simple file operation tasks. On Mac you can use the Perform AppleScript script step or the Send Event script step to use a shell command. On Windows you'd use the Send Event script step to issue the relevant command
Create an account or sign in to comment