How can we check if a directory is valid or not inside for each loop . I am having multiple files at some location and i want to load that file but before this i
 want to check if the directory is correct or not . 
If the directory is not correct it will throw error for wrong directory.

I am passing Directory path in config file.

to avoid this situation do i need to write script task for this https://social.msdn.microsoft.com/Forums/en-US/686eb963-f2ed-45b7-82fc-38694d37f14f/unexpected-behavior-of-foreach-loop-in-ssis-2012?forum=sqlintegrationservices