I am trying to create a 7z archive of certain files using Delphi 2009.
The code below seems to work, but all of the items in the resulting 7z file are of zero size. All of the file names that are in the archive are correct, but they shouldn't be zero size.
How can I add files properly to a 7z archive using JCLCompression?
var fname, archiveFileName: string; arch: TJclUpdateArchive; archiveclass: TJCLUpdateArchiveClass; sr: TSearchRec; begin fname := GetDesktop + 'Support.7z'; archiveclass := GetArchiveFormats.FindUpdateFormat(fname); if not Assigned(archiveclass) then raise Exception.Create('Could not determine the Format of ' + fname); arch := archiveclass.Create(fname); try with arch do begin if FindFirst(uFolder + '*.*', faAnyFile, sr) = 0 then begin repeat AddFile(ExtractFileName(sr.Name), sr.Name); until FindNext(sr) <> 0; FindClose(sr); end; Compress; end; finally arch.free; end; end;