Python Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming LanguagesPython Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old March 6th, 2002, 04:06 PM
99miles 99miles is offline
#-------------------------
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2002
Location: you s of a
Posts: 35 99miles User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 7
create zip archive

hi-
i am creating a zip file from a directory. it is working great, but the files in the subdirectories get put into the top level directory in the zip file. I want the directory structure to remain intact when i extract the zip file.
How can I do this? Any ideas? thanks a lot-
Mac

I am using this code, currently:

for name in glob.glob("mypath/*"):
if os.path.isfile(name):
file.write(name, os.path.basename(name), zipfile.ZIP_DEFLATED)

Reply With Quote
  #2  
Old March 15th, 2002, 10:58 PM
99miles 99miles is offline
#-------------------------
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2002
Location: you s of a
Posts: 35 99miles User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 7
o, i got it. i was using 'basename' without understanding what it meant. i should know better

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesPython Programming > create zip archive


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway