How to avoid failure in FTP Task

  • Hi,

    I am deleting files from my FTP location using the FTP task, and it works with charm.

    but the issue I am facing is that if the file doesn't exist on the remote directory, FTP task throws exception, and the package end up with failure.

    is there any way that this failure not occurs, even if the file is not present on the remote directory.

    Thanks

  • asbhatty150 (9/27/2010)


    Hi,

    is there any way that this failure not occurs, even if the file is not present on the remote directory.

    You may first check whether the file exists at remote site using a script task and then take necessary decision to manipulate the directory content...

    you may want to achieve all said operations using a script task as it will offer better code manageability and customization

    Raunak J

  • If you do not want to use script task / code to check if file exists or other properties. Then you could use this component http://filepropertiestask.codeplex.com/ I pass the existence to a variable, then use a precedence constraint and an expression to redirect the flow of the package.

    If the file exists then this will evaluate as true - (@[User::fFileExists]?"Y":"N")=="Y"

    If the file exists then this will evaluate as true - (@[User::fFileExists]?"Y":"N")=="N"

    The attachment shows the highlighted constraint, expression and the flow if the file exists. The one on the right is the one if the file does not exist, which just sends an email and ends the package.

    All this said, using a script task/code is a more powerful option and opens up more options.

    HTH

  • The easiest way to check for the file is to embed your FTP task in a ForEach container that looks for the file. If the file doesn't exist, the container exits out with a success and not running the delete task. If the file does exist, the container then runs the FTP delete task.

    EDIT: Either way, no failure unless something gets really screwed up.

    Brandie Tarvin, MCITP Database AdministratorLiveJournal Blog: http://brandietarvin.livejournal.com/[/url]On LinkedIn!, Google+, and Twitter.Freelance Writer: ShadowrunLatchkeys: Nevermore, Latchkeys: The Bootleg War, and Latchkeys: Roscoes in the Night are now available on Nook and Kindle.

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply