Sidebar

Can I selectively delete files from an SFTP source?

0 votes
198 views
asked Jul 18 by scott-m-6181 (230 points)
I have two insances of qvera running, one staging and one dev. They are both attached to the same SFTP source. I would like the staging instance to retrieve (and delete) certain messages and the dev instance to retrieve and delete the other ones. The decision will be based on the content of the message (i.e. does PID-2 start with "D" or not).

1 Answer

0 votes
I think a better design would be to have your test channel process all files, and move them to a nested "ready" folder if they don't need to be deleted and then your dev channel could just keep an eye on files that appear in the "ready" folder and delete them if it needs to.

The problem you'll run into if you have 2 nodes listening for files is that the production system might pick up files before the test system has had a chance to delete them and you'll end up with both channels tracking more messages than they need to.

I guess this means your test channel is technically processing more than it needs to as well.

You could have a structure like this:
/allfiles
/allfiles/test
/allfiels/dev

with a scheduled script/task that greps for PID-2|D... or PID-2|T and moves them into the appropriate sub-folders where the channels can pick them up for processing.
answered Jul 18 by nathan-c-4426 (580 points)
commented Jul 18 by scott-m-6181 (230 points)
edited Jul 18 by scott-m-6181
I'm not sure if I have write access to the SFTP folder.  I mean, I know that I can delete files, but I don't know if I can rename/upload files. Even so, I would have to download the file, check the PID-2 and then do my processing.

I have SFTP only access to the folder. I can't run scripts from the OS. This would all have to be done through qvera or another SFTP program
...