This will help us if you can format the code as a code; select parts of the code and click the "Sample Code" button on the editor toolbar. The icon looks like this: "101/010", and if you hold the mouse pointer over it, the yellow field "hint" says "Example code <pre> </pre> Ctrl + K"
I just tried, and if you paste the code into the StackOverflow editor, the lines with '#' will be in bold. Therefore, bold lines are comments. So far so good.
Your lines seem to contain backslash characters. You will need to double each backslash, for example:
target_dir = 'E:\\Backup'
This is because Python handles backslashes specifically. It introduces a "backslash", which allows you to put a quote inside a quoted string:
single_quote = '\''
You can also use the raw string of Python, which has much simpler backslash rules. The raw string is entered r" or r' and ends with " or ' respectively. examples:
# both of these are legal target_dir = r"E:\Backup" target_dir = r'E:\Backup'
source share