Read from FTP site: This channel shows how easy it is to use an FTP (or SFTP or FTPS) server as a data feed for Iguana.
This particular script only processes files ending in “txt” and then deletes those files off the server.
Note: Files are only deleted when the channel is running, not when you are using the Editor.
If you have any questions please contact us at email@example.com.
Using the Code [top]
- Import the Read from FTP site channel from the Builtin: Iguana Files repository
- Experiment with the code to find out how it works
- Adapt the code to your own requirements
- You will need to edit the credentials to match a working FTP server
This is the github code for the main module:
How it works [top]
The code is fairly simple:
- First we connect to the FTP server using
Note: You will need to use valid FTP credentials to get the code to work.
- Then we get a list of files from the FTP server using the
Note: The dot “.” represent the default path, you can try “/” for the root etc.
- Next we use a local function
FindFilesThatMatch()to find any matching file names.
- Finally we process the matching files by pushing them to the queue and then deleting them.
Note: You may prefer to move the files to a processed directory rather than deleting them.
- We also log the names of the processed files, or the fact that no files were processed, these messages can be viewed in the logs screen:
More information [top]
- Source code for the main module on github
- API documentation for net.ftp.init, iguana.logInfo and iguana.isTest
- Using the ftp list command