Aggiunto esportazione ed importazione videoteca

This commit is contained in:
axlt2002
2020-03-18 00:25:18 +01:00
parent b5fdaeabeb
commit b9b3770593
5 changed files with 119 additions and 3 deletions
+11
View File
@@ -104,3 +104,14 @@ class ziptools(object):
dirs.sort()
return dirs
def zip(self, dir, file):
import os
zf = zipfile.ZipFile(file, "w", zipfile.ZIP_DEFLATED)
abs_src = os.path.abspath(dir)
for dirname, subdirs, files in os.walk(dir):
for filename in files:
absname = os.path.abspath(os.path.join(dirname, filename))
arcname = absname[len(abs_src) + 1:]
zf.write(absname, arcname)
zf.close()