How to save unknown face detection

Am writing a model that face recognition with emotion detection in realtime i wanted to create a code that will save unknown face when detected ,check if it exist in database if not folder and save unknown face

example
detect unknown face => check if exist if not
create new folder named it ( unknown 1)=> and save the image inside
detect unknown face => check if exist if not
create new folder named it ( unknown 2)=> and save the image inside
detect unknown face => check if exist if not
create new folder named it ( unknown 3)=> and save the image inside
detect unknown face => check if exist if not
create new folder named it ( unknown 4)=> and save the image inside