I am trying to copy pages on the sites page using the copy option on the action bar - But whenever i try to copy the page it creates a new page if the page is existing - I am trying to come up with an ability to overwrite the file if it is existing and create a new one if the file is missing more.
AEM does not check for content while copying/moving the page. It just considers the name i.e. node name/page name. Existing functionality itself checks if the node you are trying to copy already exists it will add 1,2,3, so on with the existing node name and add the copy. If the page does not exist then it will copy the page as is. This is the OOTB functionality.