fix checking existence of the same directory three times
Merge pull request #591 from mapleoin/security-examples-duplicates

fix checking existence of the same directory three times