Python zip all files in directory script failed -



Python zip all files in directory script failed -

i want write simple script python zip file in folder. have until now:

import os import zipfile zfname = 'simonszip.zip' foo = zipfile.zipfile(zfname, 'w') dirname, dirnames, filenames in os.walk('.'): # print path filenames. filename in filenames: print (os.path.join(dirname,filename)) foo.write(os.path.join(dirname, filename)) foo.close()

when sudo python script.py script runs, never ends, while producing enormous zip file.

any ideas?

you're doing recursion. since zip created listed in files. you're writing zip within zip within zip within zip , on.

python

Comments

Popular posts from this blog

php - Android app custom user registration and login with cookie using facebook sdk -

c# - Create a Notification Object (Email or Page) At Run Time -- Dependency Injection or Factory -

Set Up Of Common Name Of SSL Certificate To Protect Plesk Panel -