Hello all, This code should add all the files of a directory in a tar file.
program e01; {$mode objfpc}{$H+} uses libtar, sysutils; var archive: TTarWriter; search: TSearchRec; BEGIN archive := TTarWriter.create('arquivo.tar'); with archive do begin try FindFirst('/home/luciano/Documentos/*', faAnyFile, search); repeat if (search.name <> '.') and (search.name <> '..') then AddFile(search.name); until FindNext(Search) = 0; finally free; end; end; END. The program compiles, but I got an error. The message says that the first file of the directory can't be opened. What is wrong? My second doubt is: I am running this program in Ubuntu 13.10. If I run it in Windows, will a external library be necessary or all the code is included in lib tar unit? Regards, -- Luciano de Souza _______________________________________________ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal