-2

// This my code compress use 7 zip

  if (System.IO.Directory.Exists(targetfolder))
                {
                    try
                    {

                        SevenZipCompressor.SetLibraryPath(@Server.MapPath("~/bin/7z.Libs.16.2.1/bin/x64/7z.dll")); 
                        SevenZipCompressor sevenZipCompressor = new SevenZipCompressor();
                        sevenZipCompressor.CompressionLevel = SevenZip.CompressionLevel.Ultra; // level compress
                        sevenZipCompressor.CompressionMethod = CompressionMethod.Lzma2; //method compress
                        sevenZipCompressor.CompressDirectory(sourceCodeFolder, Path.Combine(targetfolder, string.Concat(DateTime.Now.ToString("ddMMyyyy_HHmm") + fldr + ".zip")));
                    }

                    catch (Exception se)
                    {
                        SevenZipCompressor.SetLibraryPath(@Server.MapPath("~/bin/7z.Libs.16.2.1/bin/x86/7z.dll"));
                        SevenZipCompressor sevenZipCompressor = new SevenZipCompressor();
                        sevenZipCompressor.CompressionLevel = SevenZip.CompressionLevel.Ultra; // level compress 
                        sevenZipCompressor.CompressionMethod = CompressionMethod.Lzma2; // method compress

//what is wrong my code? sevenZipCompressor.CompressDirectory(sourceCodeFolder, Path.Combine(targetfolder, string.Concat(DateTime.Now.ToString("ddMMyyyy_HHmm") + fldr + ".zip")));

                    }


                    Directory.Delete(@Server.MapPath("~/Upload/" + fldr), true);
                    extractfrom = @Server.MapPath("~/Upload/ZIP/" + string.Concat(DateTime.Now.ToString("ddMMyyyy_HHmm")) + fldr + ".zip");

                    customSQL.ExecQueryString(" UPDATE TBL_PROGRESS_LEGAL_DOKUMEN set FileName = '" + string.Concat(DateTime.Now.ToString("ddMMyyyy_HHmm")  + namafile + ".zip"+ "'  , [FileSize] = '" + filesize + "'  where id_progress_legal_dokumen = '" + id_chekUpload.Text + "'"));
                    myfeedback._success("File Success Upload");
                }

                else
                {

                }

my question why 7zip make compress 7mb to be 6mb only?

Rahmat
  • 97
  • 10

1 Answers1

1

(Most) PDFs are already compressed and you cannot gain much by archiving them.

Why don't some files compress very much?
Which files does not reduce its size after compression

wp78de
  • 18,207
  • 7
  • 43
  • 71
  • Ok thanks sir, how about the doc file i tried from 899 kb just be 715 kb, is it that way? – Rahmat Nov 24 '17 at 02:42
  • There is no general answer. If your DOC files contain a lot of (uncompressed) text, it's bad. If there a re a lot of (already compressed) JPGs - it's most likely fine. – wp78de Nov 24 '17 at 02:56