updated script to prevent duplicates
prevent dupes: TODO: check filename duplicatation bug