Jump to content
Server Maintenance This Week. ×

How to delete import file after processing records into FM13?


This topic is 3486 days old. Please don't post here. Open a new topic instead.

Recommended Posts

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

 

  • 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

Link to comment
Share on other sites

This topic is 3486 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.