Hello please help
I just started learning python, and been trying to research on how to fix the problem, but have had no luck
.
My goal is to make the file name of the tar file with the current date. I'm either getting invalid syntax : or no support of ("path/%s.tar") % now
Any clues, or am I way off.
Code:
#!/usr/bin/python
import os
import datetime
import tarfile
now = datetime.datetime.now()
os.chdir("/home")
tar = tarfile.open("/run/media/user/backup/backup1.tar", "w:tar") # I want to name the .tar file with the current date
tar.add("/home")
tar.add("/etc")
tar.close()