Checks for directory before performing delete