Just as the title says i need to add a folder to a directory with a new name if it already has that name. i have this script that copy's a folder no problem but if run it again it fails because it already exists. is there a way i can just add the folder with a number attached to it like "backup1", "backup2", etc. Here is the script example:
import shutil
MAIN_DIR = r'Y:\A'
COPY_DIR = r'Y\B\Backup1'
shutil.copytree(MAIN_DIR,COPY_DIR)
Thank you for any help
Edit: Basically what i want is how to make a new folder and copy the contents there every time the script is run. like for example, check if backup1 exists if it does then make backup2, then copy contents to that directory. If i run it again check for backup2 if there make backup3, etc.