I'm trying to code a short program that makes backups of a folder whenever I run it. Currently it's like this:
import time
import shutil
import os
date = time.strftime("%d-%m-%Y")
print(date)
shutil.copy2("C:\Users\joaop\Desktop\VanillaServer\world","C:\Users\joaop\Desktop\VanillaServer\Backups")
for filename in os.listdir("C:\Users\joaop\Desktop\VanillaServer\Backups"):
if filename == world:
os.rename(filename, "Backup " + date)
However I get an error:
SyntaxError: (unicode error) 'unicodeescape' codec can't decode bytes in position 2-3: truncated \UXXXXXXXX escape
and I can't figure out why (according to documentation, I think my code is properly written)
How can I fix this/do it in a better way?