Home > Back-end >  "When A File Is Added Or Modified" trigger works for updated files but not created ones
"When A File Is Added Or Modified" trigger works for updated files but not created ones

Time:09-22

I have a Logic App setup to monitor an ftp site that should trigger an action when uploading file. If I upload a file, change the original and upload again, trigger fires. Simply adding a file doesn't work.

CodePudding user response:

Chances are your FTP client is preserving the timestamp of the last file change. Change this to have it trigger on newly added files, too.

FTP triggers work by polling the FTP file system and looking for any file that was changed since the last poll. Some tools let you preserve the timestamp when the files change. In these cases, you have to disable this feature so your trigger can work. Here are some common settings:

SFTP client Action
Winscp Go to Options > Preferences > Transfer > Edit > Preserve timestamp > Disable
FileZilla Go to Transfer > Preserve timestamps of transferred files > Disable

Taken from HOW FTP TRIGGERS WORK.

Next to this, please be advised the actual trigger can have a delay that is up to twice the trigger's polling interval:

When a trigger finds a new file, the trigger checks that the new file is complete, and not partially written. For example, a file might have changes in progress when the trigger checks the file server. To avoid returning a partially written file, the trigger notes the timestamp for the file that has recent changes, but doesn't immediately return that file. The trigger returns the file only when polling the server again. Sometimes, this behavior might cause a delay that is up to twice the trigger's polling interval.

  • Related