According to this post I'm calling the zip
command using os.system()
in Python.
At the command line it works:
zip -r /Backups/backups/20152011-120209{.zip,}
When I call this from a Python script (PATH
is "/Backups/backups/20152011-120209")
os.system("zip -r " + PATH + "{.zip,}")
It throws:
zip error: Nothing to do! (/Backups/backups/20152011-122909{.zip,})
What am I doing wrong?
I want to zip a directory (including its content) to a zip file with the same name at the same place (a script dumps my MySQL databases to *.sql files and I want to zip the files after that).
os.system
at all is a really bad idea. Outdated and deprecated. Usesubprocess.call()
orsubprocess.Popen()
intead. – Jacob Vlijm Nov 20 '15 at 12:45