zip

python zipfile multiple files

倖福魔咒の 提交于 2021-02-08 09:45:07
问题 i am having problems with python and zipfile, namely: I can't add a second file to my zip. here is my code, if you need more, I'll be glad to provide it. def zipDir(fn_source, fn_destinationFolder): ''' fn_destinationFolder = folder to zip fn_source = destination path for the zip ''' fn_zipfileName = os.path.join(os.path.dirname(os.path.basename(fn_source)),fn_destinationFolder)+'.zip' with zipfile.ZipFile(fn_zipfileName, 'w') as fn_zipfile: for csvFile in os.listdir(fn_destinationFolder): #

How to import ZIpped file into Postgres Table

我怕爱的太早我们不能终老 提交于 2021-02-07 19:28:03
问题 I would like to important a file into my Postgresql system(specificly RedShift). I have found a arguement for copy that allows importing a gzip file. But the provider for the data I am trying to include in my system only produces the data in a .zip. Any built in postgres commands for opening a .zip? 回答1: From within Postgres: COPY table_name FROM PROGRAM 'unzip -p input.csv.zip' DELIMITER ','; From the man page for unzip -p : -p extract files to pipe (stdout). Nothing but the file data is

How to open an html file from inside a zip?

£可爱£侵袭症+ 提交于 2021-02-07 13:39:09
问题 Is there any way to open an html file from within a zip file which contains images the html references? I generate htmls with relative paths to resources and the browser won't find them in the zip file, I have to extract it first. Opening it from the zip would be ideal. Any way to do it? 回答1: you have to extract it. When you double click on your html in the zip file, it is extracted in the background and shown to you, the only way to read anything in a compressed file is by extracting it. 回答2

Unzip gz files within folders in a main folder using python

别等时光非礼了梦想. 提交于 2021-02-07 11:01:10
问题 I have .gz zipped files within multiple folders that are all within a main folder called "usa". I was able to extract an individual file using the code below. import gzip import shutil source=r"C:\usauc300.dbf.gz" output=r"C:\usauc300.dbf" with gzip.open(source,"rb") as f_in, open(output,"wb") as f_out: shutil.copyfileobj(f_in, f_out) I have searched high and low but can't find an equivalent to the command line option gzip -dr..... which means "decompress recursive" and will go through each

compress or zip iOS sqlite Database

送分小仙女□ 提交于 2021-02-07 10:37:42
问题 People, How Can I Zip my iOS app's sqlite database? Because I'm trying to sinc it with the cloud but im having some troubles... Which classes I'm supposed to use to zip it ? please help me out! 回答1: You can use ZipArchive, its a objective c wrapper to zip/unzip - http://code.google.com/p/ziparchive/ for zip :- NSArray* paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); NSString* dPath = [paths objectAtIndex:0]; NSString* txtfile = [dPath

VSCode not recognizing includes from includepath

依然范特西╮ 提交于 2021-02-07 08:36:32
问题 I am having an issue where VSCode will recognize my include of zipper.h and then out of nowhere flip on me and tell me that there is no such file or directory. I am not sure if this is an issue with my code or includes or vs code. https://i.gyazo.com/2d35a31abf83546d8633d991bcb4752a.png https://i.gyazo.com/96ad7825e8d1c390035a4db2f789bbcf.png I have tried adding it both to my include path and windows environment path. it keeps failing for the same reason. I am very confused on what I'm doing

Github release zip containing only partial code from repo

 ̄綄美尐妖づ 提交于 2021-02-07 08:18:29
问题 while the Github provide a way to releasing software, I don't know if possible to specify just some files of the current master repository to be released and be downloaded as a zip file. I want to offer users the possibility to download a certain folder/files from the whole repository, like say; I have 3 files in my repoo, file_1.js , file_2.js , file_3.js - I want to make file_3.js a downloadable release as a zip file my_app_v1.0.zip . How is that possible? Thanks for any ideas :) 回答1: The

Github release zip containing only partial code from repo

偶尔善良 提交于 2021-02-07 08:17:20
问题 while the Github provide a way to releasing software, I don't know if possible to specify just some files of the current master repository to be released and be downloaded as a zip file. I want to offer users the possibility to download a certain folder/files from the whole repository, like say; I have 3 files in my repoo, file_1.js , file_2.js , file_3.js - I want to make file_3.js a downloadable release as a zip file my_app_v1.0.zip . How is that possible? Thanks for any ideas :) 回答1: The

diff files inside of zip without extracting it [closed]

寵の児 提交于 2021-02-07 04:57:14
问题 Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 26 days ago . Improve this question Is there any way to perform diff operetion on two files in two zips without extracting them? If not - any other workaround to compare them without extracting? Thanks. 回答1: Combining the responses so far, the following bash function will compare the file listings

Delphi XE2 TZipFile: replace a file in zip archive

China☆狼群 提交于 2021-02-07 02:32:17
问题 I'd like to replace a file (= delete old and add new) in a zip archive with the Delphi XE2/XE3 standard System.Zip unit. But there are no replace/delete methods. Does anybody have an idea how it could be achieved without needing to extract all files and add them to a new archive? I have this code, but it adds the "document.txt" once more if it's already present: var ZipFile: TZipFile; SS: TStringStream; const ZipDocument = 'E:\document.zip'; begin ZipFile := TZipFile.Create; //Zipfile: