Creating tar file from the folder containing files without compression in c#, using 7zip. I m creating a tar file to be consumed by an SAP system on the client-side. It's not able to open the file created by my program.
public static void Create_tar(string sourceName, string targetName) {
string target = Path.GetFileNameWithoutExtension(targetName); var allowedFileExtensions = ".pdf,.att,.dat"; var filePaths = Directory.EnumerateFiles(Path.Combine(sourceName,target), "*.*", SearchOption.TopDirectoryOnly) .Where(s => allowedFileExtensions.IndexOf(Path.GetExtension(s)) > -1).ToArray(); for (int i = 0; i < filePaths.Length; i++) { ProcessStartInfo p = new ProcessStartInfo(); p.FileName = @"C:\Program Files (x86)\7-Zip\7z.exe"; p.Arguments = "7za.exe a -ttar\"" + targetName + "\" \"" + filePaths[i]; p.WindowStyle = ProcessWindowStyle.Hidden; Process x = Process.Start(p); x.WaitForExit(); } } https://stackoverflow.com/questions/65572634/creating-tar-file-from-folder-containing-files-without-compression-in-c-sharp January 05, 2021 at 10:57AM
没有评论:
发表评论