Check for duplicate files and manage them