Detecting "No File Found" with ForEach File Enumerator?

  • I've built a package with a ForEach File Enumerator. It works great when there are files. When there are no files it just drops to the next step. I'd like it to go to Failure step when no files are found, but I can't find a property or event associated with the Enumerator that deals with No Files Found.

    Do I have to write a script task first to check for files? I'd really rather not.

    If anyone can direct me on how to throw an error if the ForEach Files Enumerator finds no files it would be really helpful...:w00t:

     

  • Add a variable to your package and increment the variable within the ForEach loop. If there are no files, the variable will remain zero and you can check it in the control flow connector going to the next step.

  • I had thought of something like that, or a script task in front of the enumerator to check for the existence of any files and fail if there are no files. If there's a way to actually detect and handle the condition using the enumerator's properties and events I'd prefer that.

    I can't believe there's no "No Files Found" event or "Fail on No Files" property for the enumerator...

     

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

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