How to extract directory and all contents from .TAR? #565
-
Hey folks, I am relatively new to .NET programming and have found success extracting individual files using the SharpZipLib.Tar library (all thanks to the excellent examples in the wiki). However, I need to figure out a way to extract a specific directory and all of its contents from a .TAR file, all while maintaining the folder structure of that directory. The example in the wiki seems to only cover the extraction of individual files, would anyone have a code sample that showcases the extraction of a directory from .TAR? I can provide more information if necessary, thank you! |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
The easiest way is probably to loop over the entries as shown in and then check the file name (in-archive path) against the directory you want, and then skip all other entries. |
Beta Was this translation helpful? Give feedback.
-
Thank you @piksel, your description helped me to solve the issue. |
Beta Was this translation helpful? Give feedback.
The easiest way is probably to loop over the entries as shown in
https://github.com/icsharpcode/SharpZipLib/wiki/GZip-and-Tar-Samples#-extract-from-a-tar-with-full-control
and then check the file name (in-archive path) against the directory you want, and then skip all other entries.