Skip to content

TTarWriter.AddFile

Add a file to the archive.

Declaration

Source position: libtar.pp line 221

public 
procedure TTarWriter.AddFile(const Filename: AnsiString; 
                            TarFilename: AnsiString='');

Description

AddFile adds a file to the archive: the contents is read from FileName. Optionally, an alternative filename can be specified in TarFileName. This name should contain only forward slash path separators. If it is not specified, the name will be computed from FileName.

The archive entry is written with the current owner data and permissions.

Errors

If FileName cannot be opened, an exception will be raised.

See also

Name Description
TTarWriter.AddStream Add stream contents to archive.
TTarWriter.AddString Add string as file data.
TTarWriter.AddLink Add hard link to archive.
TTarWriter.AddSymbolicLink Add a symbolic link to the archive.
TTarWriter.AddDir Add directory to archive.
TTarWriter.AddVolumeHeader Add volume header entry.