Refactored prepareOutputDir to preventing deletion of hidden files (including .git)