ZipAllFiles Result := true finally OurZipper. UseLanguageEncoding := true // Requires FPC 3.2+ // create and write the zip file OurZipper. UTF8 encoding is written when UseLanguageEncoding is true. Free end // By default zipper writes file names in encoding of the IBM PC, CP437. AddFileEntry ( diskFileName, archiveFileName ) end finally list. We remove the deirectory from the archiveFileName := StringReplace ( diskFileName, ADirectory, '', ) // Store these filenames for the zipper OurZipper. ![]() Count - 1 do begin // diskfilename is the name of the file to be zipped on the disk diskFileName := list // archivefilename is the name of the file to be zipped as it appears // in the zip. FindAllFiles ( list, ADirectory, AMask, IncludingSubDirs ) for i := 0 to list. When IncludingSubDirs is true the search continues recursively in // the subdirectories. '*.*') // found in the given directory to the provided list. Create try // FindAllFiles adds all file names matching the mask (e.g. FileName := AZipFileName // Read names of the files contained in ADirectory to a stringlist list := TStringList. Create try // Set the name of the zip file to be created OurZipper. Uses FileUtil, zipper function PackFiles ( AZipFilename, ADirectory, AMask : String IncludingSubDirs : Boolean ) : Boolean var OurZipper : TZipper list : TStringList i : Integer diskFileName, archiveFileName : String begin Result := false ADirectory := IncludeTrailingPathDelimiter ( ADirectory ) if DirectoryExists ( ADirectory ) then begin OurZipper := TZipper.
0 Comments
Leave a Reply. |