Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » U++ Library support » U++ Library : Other (not classified elsewhere) » Is it possible to compress many files in one GZ file?
Is it possible to compress many files in one GZ file? [message #55668] Sun, 29 November 2020 10:16 Go to next message
Patisab is currently offline  Patisab
Messages: 21
Registered: December 2015
Location: France
Promising Member
Hello,

When i try to compress many files in one GZ file, only the last one is in it. Well, i think that GZ file is always open for writing only, not for writing and appending.

Now, it's looking like that :

FindFile ffFic;
String lFic, lGz;
lFic = "FicLog.log.*";
lGz = "FicLog.gz";

if (ffFic.Search(lFic) && PromptYesNo("Delete log files?")){
	do {
		GZCompressFile(lGz.ToString(),ffFic.GetPath().ToString());
		FileDelete(ffFic.GetPath());
	} while (ffFic.Next());
}


I have three questions to submite to you :

- Do you see some problems with the code?
- Can it be possible to append files with the GZCompressFile function? If yes, how?

Thank you very much for your help.

Best regards.
Re: Is it possible to compress many files in one GZ file? [message #55675 is a reply to message #55668] Sun, 29 November 2020 20:38 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 14162
Registered: November 2005
Ultimate Member
Patisab wrote on Sun, 29 November 2020 10:16
Hello,

When i try to compress many files in one GZ file, only the last one is in it. Well, i think that GZ file is always open for writing only, not for writing and appending.

Now, it's looking like that :

FindFile ffFic;
String lFic, lGz;
lFic = "FicLog.log.*";
lGz = "FicLog.gz";

if (ffFic.Search(lFic) && PromptYesNo("Delete log files?")){
	do {
		GZCompressFile(lGz.ToString(),ffFic.GetPath().ToString());
		FileDelete(ffFic.GetPath());
	} while (ffFic.Next());
}


I have three questions to submite to you :

- Do you see some problems with the code?
- Can it be possible to append files with the GZCompressFile function? If yes, how?

Thank you very much for your help.

Best regards.


Well, that is the nature of .gz, it is just one file...

I guess what you mean is .tar.gz? (No support for tar in U++ yet, sorry).
Re: Is it possible to compress many files in one GZ file? [message #55676 is a reply to message #55675] Sun, 29 November 2020 20:59 Go to previous messageGo to next message
Novo is currently offline  Novo
Messages: 1378
Registered: December 2006
Ultimate Contributor
bz2 can store separate pieces/files in one archive.
Take a look at bz2::CompressStream/bz2::DecompressStream. But you will need to store offsets separately ...


Regards,
Novo
Re: Is it possible to compress many files in one GZ file? [message #55680 is a reply to message #55675] Mon, 30 November 2020 10:54 Go to previous messageGo to next message
Patisab is currently offline  Patisab
Messages: 21
Registered: December 2015
Location: France
Promising Member
Hi Mirek,

You're right, i would talk about TGZ. I will try Novo's proposal.

Thank you for help.

Best regards.
Re: Is it possible to compress many files in one GZ file? [message #55681 is a reply to message #55676] Mon, 30 November 2020 10:56 Go to previous message
Patisab is currently offline  Patisab
Messages: 21
Registered: December 2015
Location: France
Promising Member
Hi Novo,

Thank you for your proposal. Il will try it soon Wink

Best regards.
Previous Topic: SOLVED SetLabel issue
Next Topic: plugin/Eigen updated to stable release 3.3.9
Goto Forum:
  


Current Time: Fri Dec 13 23:43:45 CET 2024

Total time taken to generate the page: 0.03305 seconds