Thursday, March 29, 2012

FTP Task question

Hi,

In the FTP Task, is there any way to set it so that once a file is successfully FTP'd down, it deletes the file on the ftp server?

We need to be able to do this so that on the next day's ftp, we don't download OLD files, ie) the one from the day before with the same name. Deleting the file immediately after successful download will ensure that this never happens.

Thanks

I have one possible approach that you could use to achieve this:

Have one FTP task that does the operation of "Receive Files". A second FTP task can be used to the operation of "Delete Remote Files" and the precedence constraint between the first and the second task could be that the second one executes on the first task returning success.

Thanks,

Bhargavi


This posting is provided "AS IS" with no warranties, and confers no rights.

|||

Yes, I see that option now.

What happens in the event that the file does not exist - it got deleted some other way? Then I can't move forward on a success constraint, as it will be a failure.

I suppose I could have two "paths" but that seems kind of klunky.

Is there a better way to handle this?

Thanks

|||

You could use Completion. However, if the file doesn't exist, you don't want to try to delete it, do you?

I'd probably put both the FTP Task to download the file and the FTP Task to delete the file in a sequence container. Use an Success constraint between the download task and the delete task, and a Completion contraint between the sequence container and the next task to be executed.

|||It's not "klunky", it's really pretty straight forward and self-documenting. If the retrieval is SUCCESSful, DELETE the file. If the retrieval is SUCCESSful...any other steps. Use the COMPLETION to move forward with any steps that do not rely on the retrieval.

No comments:

Post a Comment