Aggiunto esportazione ed importazione videoteca
This commit is contained in:
@@ -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()
|
||||
Reference in New Issue
Block a user