Added logic to validate the directory.
Small fix.
Merge pull request #11 from ruimalheiro/master

Added directory validation