Handle gracefully directories like files