ZipFile Help Programming Software Development by baseballer … void main(String[] args) { Enumeration <?> entries; ZipFile zipFile; if(args.length != 1) { System.err.println("Usage…: Unzip zipfile"); return; } try { zipFile = new ZipFile(args[0]); entries = zipFile.entries(); while(entries.hasMoreElements()) { ZipEntry … Re: ZipFile Help Programming Software Development by DavidKroukamp … void main(String[] args) { Enumeration <?> entries; ZipFile zipFile; if(args.length != 1) { System.err.println("Usage…: Unzip zipfile"); return; } try { zipFile = new ZipFile(args[0]); entries = zipFile.entries(); while(entries.hasMoreElements()) { ZipEntry … Re: ZipFile Help Programming Software Development by DavidKroukamp … just been busy with school look at line 23:[code]zipFile = new ZipFile(args[0]);[/code]the args[0] is the files… name you can change this to your need ie:[code]zipFile = new ZipFile("C:\whatever.zip");[/code] Re: zipfile Programming Software Development by iamthwee …file for writing, and write stuff to it file = zipfile.ZipFile("test.zip", "w") for name…;samples/*"): file.write(name, os.path.basename(name), zipfile.ZIP_DEFLATED) file.close() # open the file again, to …see what's in it file = zipfile.ZipFile("test.zip", "r") for info… zipfile Programming Software Development by rajivgupta1107 Hi, I am using this zipfile.Zipfile module to zip around 600 MB of data. But after …, the size of the zipped folder is app. same. file = zipfile.ZipFile(yesterday_date_time + ".zip","w") os.chdir(rawFileLocation… Re: zipfile Programming Software Development by bumsfeld … = %d" % len(text2)) # the other way to compress ... # create zipfile compressed file # in this case the compressed file is larger… than the original! import zipfile as zf z_fname = 'longtext.zip' zout = zf.ZipFile(z_fname, 'w', compression=zf.ZIP_DEFLATED) zout… Zipfile Programming Software Development by TheNational22 … no object attrib error. Any ideas? [code] import os import zipfile import datetime today = datetime.date.today() yesterday = (today + datetime.timedelta…(days=-1)) file = zipfile.Zipfile("CT" + yesterday.strftime('%m%d%y') +".zip… Re: Zipfile Programming Software Development by TheNational22 … that was passed from the listdr. [code] import os import zipfile import datetime today = datetime.date.today() yesterday = (today + datetime.timedelta…(days=-1)) tFile = zipfile.ZipFile("c:\\crunchtime\\CT" + yesterday.strftime('%m%d%y… Re: Zipfile Programming Software Development by sneekula … rewrite your code like this: [code=python]import os import zipfile import datetime today = datetime.date.today() yesterday = (today + datetime.timedelta…%d%y') +".zip" # test it print zfilename tFile = zipfile.ZipFile(zfilename, "w") directory = "c:\\crunchtime" files… Re: ZipFile question: Modifying contents of file inside archive Programming Software Development by nosehat …'t do that while the file was still open with zipfile, which would mean I'd have to log all the… files I'd want to make in each archive, close zipfile, then open the archive file again with subprocess.Popen. Unfortunately… if there's a way to do this just with zipfile? ZipFile question: Modifying contents of file inside archive Programming Software Development by nosehat …, files in os.walk(maindir): for currentfile in files: currentzip = zipfile.ZipFile(os.path.join(root, currentfile), mode='r') innernames = currentzip.namelist… Re: ZipFile Help Programming Software Development by baseballer No I believe it works - I get the error message, what I don't understand completely is where I write in what file it is supposed to read in/if that is even how it works. Re: zipfile Programming Software Development by Nick Evan Also keep in mind that some file-types (like jpeg for example) won't compress very well because they're already compressed. What type of files are you trying to compress? Re: Quick question RE zipfile.extract Programming Software Development by richieking … create a new zip file. Simple. [CODE]import zipfile if __name__ =="__main__": ext=["py"…doc"] nfile=[] #to take new file list ffile=zipfile.ZipFile("/home/richie/r.zip","w") #… New zip zfile= zipfile.ZipFile("/home/richie/GUI2Exe.zip","r")# … Quick question RE zipfile.extract Programming Software Development by nosehat … [URL="http://docs.python.org/library/zipfile.html"]zipfile module[/URL] to extract all the files with…snippet of code that does the extracting: [CODE] currentzip = zipfile.ZipFile(os.path.join(zdir, zfile), mode='r') innernames = …the unwanted directories, but it seems like the zipfile module ought to be able to just extract the… Create zip file using zipfile without zipping absolute path Programming Software Development by A-M-G …gt; Folder_to_be_zipped -> {contents of Folder_to_be_zipped}** import os import zipfile def zipdir(path, zip): for root, dirs, files in os….path.join(root, file)) if __name__ == '__main__': zipf = zipfile.ZipFile('Python.zip', 'w') zipdir('C:/Users/UserName/Documents/Folder_to_be_zipped/', zipf… Re: Quick question RE zipfile.extract Programming Software Development by woooee [URL=http://effbot.org/librarybook/zipfile.htm]Effbot's example[/URL] for reading a file into … as long as the files are not huge. [CODE]import zipfile file = zipfile.ZipFile("samples/sample.zip", "r") for… Re: Zipping folder and it underfolders and files with Zipfile Programming Software Development by Ismatus3 …path.normcase(archivePath) outFile = zipfile.ZipFile(zipFilePath, "w", compression=zipfile.ZIP_DEFLATED) for (archiveDirPath, dirNames… not fileNames and not dirNames: zipInfo = zipfile.ZipInfo(trimPath(archiveDirPath) + "/")… Zipping folder and it underfolders and files with Zipfile Programming Software Development by Ismatus3 … #-*- coding:Utf-8 -*- import os import time import sys import zipfile target_dir = 'C:\Dossier_target' today = target_dir + os.sep + time.strftime('%Y…. Nous utilisons la commande zip pour creer une archive f = zipfile.ZipFile('%s.zip' %target , 'w') for i in range(len(source… Re: Zipping folder and it underfolders and files with Zipfile Programming Software Development by Gribouillis … -*-coding: utf8-*- import contextlib import itertools import os.path import zipfile ROOT = 'Haplorhini' ROOT_TREE = { 'Tarsiiformes':{ 'Tarsiidae.txt': …x in modified_sequence(dirs): print(x) zip = zipfile.ZipFile(os.path.join(os.path.expanduser('~'), 'result.… Re: ZipFile question: Modifying contents of file inside archive Programming Software Development by Gribouillis I found this [url]http://stackoverflow.com/questions/4799553/how-to-update-one-file-in-a-zip-archive[/url] . It's not python, but it could be a starting point. In windows you could try with 7zip. Re: Quick question RE zipfile.extract Programming Software Development by nosehat Many thanks to both of you! Using .read to get the file's bytes, then write out the file how I want will do the trick. It will also let me handle the problem of duplicate file names the way I want to. Richie, your test for the extension is much better than mine, since it allows for extensions of any length, and since mine could be easily … Re: Create zip file using zipfile without zipping absolute path Programming Software Development by Gribouillis Did you try oldwd = os.getcwd() os.chdir('C:/Users/UserName/Documents') try: zipdir('Folder_to_be_zipped', zipf) finally: os.chdir(oldwd) ? Re: Zipping folder and it underfolders and files with Zipfile Programming Software Development by Ismatus3 Thank you for the reply , but i just want to modify the code i have putted . Re: Zipping folder and it underfolders and files with Zipfile Programming Software Development by Gribouillis To add the files in the subfolders, you must generate their paths. Re: Zipping folder and it underfolders and files with Zipfile Programming Software Development by Gribouillis > for next step , i just need to know a better way to send the file ( . the zip file created ) to an other computer (on windows environnement). The easiest way I know to do that is to have a ssh server running on the remote computer and connect using module paramiko. Re: Zipping folder and it underfolders and files with Zipfile Programming Software Development by Ismatus3 yes , you have right , but maybe ssh don't work in windows environnement , it could be solved using win32wnet module . Re: Zipping folder and it underfolders and files with Zipfile Programming Software Development by Gribouillis In the past I used copssh on windows and it was very easy to install and use. Re: Zipping folder and it underfolders and files with Zipfile Programming Software Development by Ismatus3 Hello , I don't know copssh , thank you for your help . Python CPU Performance Analysis Programming Software Development by cjohnweb …) 1 0.000 0.000 0.015 0.015 zipfile.py:405(_ZipDecrypter) 1613 0.016 0.000 0.…1 0.000 0.000 0.000 0.000 zipfile.py:654(ZipFile) 40 0.002 0.000 0.197 0.…) 6 0.017 0.003 0.061 0.010 zipfile.py:755(_RealGetContents) 1 0.000 0.000 0.…