fix build script to deal with hidden files without duplicating files