Creating a tar.gz with respect to symlinks #830
Unanswered
TylerMizuyabu
asked this question in
Q&A
Replies: 1 comment 2 replies
-
Yes, but you would need to identify the link yourself ( foreach (FileInfo info in fileInfos)
{
if (isSymlink(info, out var target))
{
var tarEntry = TarEntry.CreateTarEntry(info.FullName);
tarEntry.TarHeader.LinkName = target;
tarEntry.TarHeader.TypeFlag = TarHeader.LF_SYMLINK;
tarArchive.WriteEntry(tarEntry, false);
}
else
{
tarArchive.WriteEntry(TarEntry.CreateEntryFromFile(info.FullName), false);
}
} Edit: Actually, since .NET 6 it is now possible to work with symlinks and unix permissions, so perhaps support for this ought to be (finally) added to |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hello, I'm currently trying to use this library to create a .tar.gz of a user's local workspace. This workspace may or may not contain symlinks, and ideally I want to preserve all symlinks that link to folder/files within the local workspace. Currently when I try to do this with code like the following:
The symlink file does not get preserved. Instead one of the following two things happen:
Is there a way I can add the symlink itself to the archive?
Beta Was this translation helpful? Give feedback.
All reactions