How to read a text file manually uploaded via FTP?

We have a third-party company who provides us with data updates by uploading XML files to the uploads directory of Directus. We thought it would be easy for us to read the data in the files, to then update the database when needed. But we just cannot find a way to actually read the files that have been uploaded…:

  • there is no flow step that allows us to ‘open file’ or ‘read file’ from the local filesystem
  • the ‘run script’ step has no access to the local filesystem, and does not allow us to import any node modules that might provide it
  • we’ve searched through the available marketplace extensions, and could not find any that would allow us to simply “read a (local) file”

Are we missing something obvious, or is this something that cannot be done?

Any guidance would be greatly appreciated! :folded_hands:

Yeah so I self-host a dockerised Directus too using Digital Ocean, and I use their serverless Functions for this kind of thing. It works really well. I use Python to write my script, and have a Directus Flow call it with a webhook operation and send it whatever data it needs to do its thing, and return a result.
For anything that’s a bit complex, it’s much easier than messing around with complicated Flows.

Thank you for the info, @Burvs!
I’m self-hosting on PikaPods, which means I’m somewhat limited as to what I can install and configure on the server. But you’ve given me an idea: I can setup another pod with an automation app — like Activepieces or Automatisch — which might be able to do what you described, without me having to write a script or maintain a server. :wink:

Once again, thanks for chiming in! It would be awesome if we could just read a file from within the flow, though…

I think you’d need to use a webhook to an external script of some sort to be able to do this. You’re correct that there’s no way of accessing the contents of a file using a flow.

Or give restricted api access to your third-party company and have them write the contents of their xml into a text field rather than upload a file.

@Burvs unfortunately the third-party company can only provide data by uploading XML files via FTP… No dialogue or negotiations there.

We are using the dockerised, self-hosted version of Directus. Are you suggesting that we could run some external (shell) script, that could be made available via a webhook flow inside Directus? Or are you suggesting that we’d need to setup a whole, separate system outside Directus to handle the webhook request, and run the script?