Guest User

Untitled

a guest
Jan 18th, 2018
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.62 KB | None | 0 0
  1. $ python
  2. Python 2.7.2 (default, Oct 11 2012, 20:14:37)
  3. [GCC 4.2.1 Compatible Apple Clang 4.0 (tags/Apple/clang-418.0.60)] on darwin
  4. Type "help", "copyright", "credits" or "license" for more information.
  5. >>> import subprocess
  6. >>> subprocess.call(['zip', 'example.zip', 'example/*'])
  7. zip warning: name not matched: example/*
  8.  
  9. zip error: Nothing to do! (example.zip)
  10. 12
  11. >>> quit()
  12. $ zip example.zip example/*
  13. adding: example/file.gz (deflated 0%)
  14.  
  15. import glob
  16. import subprocess
  17.  
  18. subprocess.call(['zip', 'example.zip'] + glob.glob('example/*'))
  19.  
  20. directory = 'example'
  21. subprocess.call(['zip', '-r', 'example.zip', directory])
Add Comment
Please, Sign In to add comment