title: Better way to zip files in Python (zip a whole directory with a single command)?
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/296499/how-do-i-zip-the-contents-of-a-folder-using-python-version-2-5">How do I zip the contents of a folder using python (version 2.5)?</a>  </p>
  </blockquote>
  
  
  
  <p>Suppose I have a directory: <code>/home/user/files/</code>. This dir has a bunch of files:</p>
  
  <pre><code>/home/user/files/
    -- test.py
    -- config.py
  </code></pre>
  
  <p>I want to zip this directory using <code>ZipFile</code> in python. Do I need to <a href="https://stackoverflow.com/questions/458436/adding-folders-to-a-zip-file-using-python">loop through the directory and add these files recursively</a>, or is it possible do pass the directory name and the ZipFile class automatically adds everything beneath it?</p>
  
  <p>In the end, I would like to have:</p>
  
  <pre><code>/home/user/files.zip (and inside my zip, I dont need to have a /files folder inside the zip:)
    -- test.py
    -- config.py
  </code></pre>