files tar.gz
tar -czvf name-of-archive.tar.gz /path/to/directory-or-file
files tar.gz
tar -czvf name-of-archive.tar.gz /path/to/directory-or-file
save file tar.gz c#
//Perhaps the most popular package in NuGet that supports TAR is SharpZipLib.
//Its wiki includes examples for working with tar.gz files, including creation.
//The linked example archives an entire folder.
//To archive a single file, the sample can be simplified to this:
private void CreateTarGZ(string tgzFilename, string fileName)
{
using (var outStream = File.Create(tgzFilename))
using (var gzoStream = new GZipOutputStream(outStream))
using (var tarArchive = TarArchive.CreateOutputTarArchive(gzoStream))
{
tarArchive.RootPath = Path.GetDirectoryName(fileName);
var tarEntry = TarEntry.CreateEntryFromFile(fileName);
tarEntry.Name = Path.GetFileName(fileName);
tarArchive.WriteEntry(tarEntry,true);
}
}
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us