apply Gaudi Merge Request 212: gaudi/Gaudi!212 (merged)
improved the logic to exclude unwanted subdirectories