现在有一个最大的BUG,譬如目录格式
\XML\AAAAA\AAAA.XML
\XML\AAAAA1\AAAA1.XML
\XML\AAAAA2\AAAA2.XML
....,
我希望打包的格式
\XML\AAAAA\AAAA.XML
AAAAA1\AAAA1.XML
AAAAA2\AAAA2.XML
但是
也就是说目录名称相似时候,打包会忽略掉,用VCLZIP会只打包第一个目录
ZIPTV倒是把报打进去了,但是用控件解饱(两种我都用了)确只能解开第一包,其他的都跳过了,

解决方案 »

  1.   

    你自己用程序控制一下。使用findfirst、findnext、findclose这几个api函数很容易枚举出全部文件,然后将文件压缩到一个文件流中,同时去记录文件名等信息。
      

  2.   

    试试 Abbrevia(推荐) 或 ZipForge
      

  3.   

    帮忙啊,Xceed Zip 可以,不过要收费,
      

  4.   

    自己写代码遍历目录就好了。然后参考下面代码压缩:uses 
      Zlib; procedure CompressFiles(Files : TStrings; const Filename : String); 
    var 
      infile, outfile, tmpFile : TFileStream; 
      compr : TCompressionStream; 
      i,l : Integer; 
      s : String; begin 
      if Files.Count > 0 then 
      begin 
        outFile := TFileStream.Create(Filename,fmCreate); 
        try 
          { the number of files } 
          l := Files.Count; 
          outfile.Write(l,SizeOf(l)); 
          for i := 0 to Files.Count-1 do 
          begin 
            infile := TFileStream.Create(Files[i],fmOpenRead); 
            try 
              { the original filename } 
              s := ExtractFilename(Files[i]); 
              l := Length(s); 
              outfile.Write(l,SizeOf(l)); 
              outfile.Write(s[1],l); 
              { the original filesize } 
              l := infile.Size; 
              outfile.Write(l,SizeOf(l)); 
              { compress and store the file temporary} 
              tmpFile := TFileStream.Create('tmp',fmCreate); 
              compr := TCompressionStream.Create(clMax,tmpfile); 
              try 
                compr.CopyFrom(infile,l); 
              finally 
                compr.Free; 
                tmpFile.Free; 
              end; 
              { append the compressed file to the destination file } 
              tmpFile := TFileStream.Create('tmp',fmOpenRead); 
              try 
                outfile.CopyFrom(tmpFile,0); 
              finally 
                tmpFile.Free; 
              end; 
            finally 
              infile.Free; 
            end; 
          end; 
        finally 
          outfile.Free; 
        end; 
        DeleteFile('tmp'); 
      end; 
    end; procedure DecompressFiles(const Filename, DestDirectory : String); 
    var 
      dest,s : String; 
      decompr : TDecompressionStream; 
      infile, outfile : TFilestream; 
      i,l,c : Integer; 
    begin 
      // IncludeTrailingPathDelimiter (D6/D7 only) 
      dest := IncludeTrailingPathDelimiter(DestDirectory);   infile := TFileStream.Create(Filename,fmOpenRead); 
      try 
        { number of files } 
        infile.Read(c,SizeOf(c)); 
        for i := 1 to c do 
        begin 
          { read filename } 
          infile.Read(l,SizeOf(l)); 
          SetLength(s,l); 
          infile.Read(s[1],l); 
          { read filesize } 
          infile.Read(l,SizeOf(l)); 
          { decompress the files and store it } 
          s := dest+s; //include the path 
          outfile := TFileStream.Create(s,fmCreate); 
          decompr := TDecompressionStream.Create(infile); 
          try 
            outfile.CopyFrom(decompr,l); 
          finally 
            outfile.Free; 
            decompr.Free; 
          end; 
        end; 
      finally 
        infile.Free; 
      end; 
    end;