[Mono-list] how to compress a directory?

Abe Gillespie abe.gillespie at gmail.com
Tue Oct 28 11:35:56 EDT 2008


This has been built into the framework since .Net 2.0.  I would assume
Mono supports it as well:

http://msdn.microsoft.com/en-us/library/system.io.compression.gzipstream.aspx

-Abe

On Tue, Oct 28, 2008 at 10:45 AM, Juan C. Olivares <juancri at juancri.com> wrote:
> Rolando:
>
> I think the "clean" way is to use SharpZipLib, which is a managed library
> for ZIP:
>
> http://www.icsharpcode.net/OpenSource/SharpZipLib/
>
> Regards,
> Juan C. Olivares
>
> On Tue, Oct 28, 2008 at 10:55 AM, Rolando Martinez
> <rolandomartinezg at gmail.com> wrote:
>>
>> Hi,
>> I have a web app and I would like what is the correct way to compress a
>> directoy inside my application?
>> Currently I have the next code, but I have the problem that when the user
>> download the file, he can see the complete path inside of tar.gz file
>> (var/www/webapp/app_data/directory)...I would like to have just the folder
>> inside of tar.gz :)
>>
>>
>>        public static bool Compress(string localeFolder, string
>> nameOfGzipFile)
>>         {
>>             System.Diagnostics.Process process = new
>> System.Diagnostics.Process ();
>>             process.StartInfo.FileName = "tar";
>>             process.StartInfo.Arguments = " -czvf " + nameOfGzipFile +" "
>> + localeFolder;
>>             process.Start ();
>>             process.WaitForExit ();
>>
>>             return (process.ExitCode == 0);
>>
>>         }
>>
>> Thank you !!!
>> Rolando.
>>
>> _______________________________________________
>> Mono-list maillist  -  Mono-list at lists.ximian.com
>> http://lists.ximian.com/mailman/listinfo/mono-list
>>
>
>
> _______________________________________________
> Mono-list maillist  -  Mono-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-list
>
>


More information about the Mono-list mailing list