This project is read-only.

Documentation

Setting Up

  • Download the archivist-bin zip file
  • Extract the file into a directory
  • Place the bin within your path

Extracting Tar Files

  tar -xf <<file_name.tar>>


or for verbose output
  tar -xvf <<file_name.tar>>

Extracting GZipped Tar Files

  tar -xzf <<file_name.tar>>

Listing Entries Within Tar File

  tar -lf <<file_name.tar>>


or for verbose output
  tar -lvf <<file_name.tar>>

Creating Tar File

  tar -cf <<file_name.tar>> <<file_or_dir>> <<file_or_dir>> ...

Creating GZipped Tar File

  tar -czf <<file_name.tar.gz>> <<file_or_dir>> <<file_or_dir>> ...


Programmatically Reading Tar Files

  • Add the Archivist.Tar.dll to your project. You can find the assembly in the bin download distribution or you can build it yourself from source.
  • Next, load up the file
  Archivist.Tar.TarFile tarFile = new Archivist.Tar.TarFile(new FileStream("sample.tar", FileMode.Open));


If you want to read a gzipped tar file, instead
  FileStream fileStream = new FileStream("sample.tar", FileMode.Open)
  Archivist.Tar.TarFile tarFile = new Archivist.Tar.TarFile(new GZipStream(fileStream, CompressionMode.Decompress));

  • Then iterate over the entries
  ICollection<Archivist.Tar.TarEntry> entries = tarFile.GetTarEntries();
  foreach(TarEntry entry in entries)
  {
     //access the entry and do something with it
  }

Programmatically Creating Tar Files

First, add the files and directory to a collection
  ICollection<FileSystemInfo> fsis = new List<FileSystemInfo>();
  fsis.Add(new DirectoryInfo(""mydir"));
  fsis.Add(new FileInfo(""myfile.txt"));


Create the tarFile and write its content
  TarFile tarFile = new TarFile(fsis, new DirectoryInfo(Environment.CurrentDirectory));
  tarFile.WriteTarFileToStream(new FileStream("myarchive.tar", FileMode.Create););

Last edited Oct 17, 2007 at 3:49 PM by sisbell, version 8

Comments

No comments yet.