ForEach File Enumerator:How to trap for a known missing file

  • Using the ForEach File enumerator, if it does not find a file, the message returned is: "enumerator is empty" and "enumerator did not find any files..."

    What are some ways to trap for this missing file situation, if I am expecting a file, so that I can branch off?

    In my case, I am looking for a db backup that could be on one of two file servers (and not always the same one)

    Why Do I need this???

    Well, I have several databases balanced over two mirrored servers. The backups for each server are copied over to different file servers. So, depending on which server a database is running as the principal, my backup could be on one of two different file servers. My SSIS package is set to go get the backups, and restore them automatically (and daily)

    Thanks!

    The more you are prepared, the less you need it.

  • You may use the expression somthing like LEN(@[User::FilePath])==0? True : False in the subsequent precedence constraint editor to do your 'else' part OR use this kind of expression to disable further execution of your package.

    Note: Filepath is the user variable that holds the value of the collection mapping.

    HTH

  • Interesting. So is filepath a declared user variable?

    I'm dynamically building the Filespec via expression, since I already know what the file name should be, if it exists. I expect the foreach to really on get one or no files.

    I was really hoping that there was a property that could be looked at, telling me via an error code, or what ever, that a file was not found.

    The more you are prepared, the less you need it.

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

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