I then to tar and then gzip a list of files in C#.
I need some help with how to set the arguments to tar.
Say I have tar.exe in a folder c:\tar\tar.exe and a method like the following:
private void RunTar(string outputFileName, List<string> fileNamePaths)
{
using (Process p = new Process())
{
p.StartInfo.FileName = @"c:\tar\tar.exe";
p.StartInfo.Arguments = //;
p.Start();
p.WaitForExit();
}
}
Note: the fileNamePathsToTar list has the full unc filename paths and the files can be in different folders.
Can anyone please help with what arguments to supply.
Also I notice in the documentation:
-z, --gzip, --ungzip
filter the archive through gzip
-Z, --compress, --uncompress
filter the archive through compress
--use-compress-program=PROG
filter through PROG (must accept -d)
Not sure how to use this but if I place the gzip.exe in the same folder as tar.exe can I perform my tar and then gzip of these files all in one step?
Update
I can only seem to get tar to work on files in the same directory as tar.exe if I try a full path name I get something like:
C:\Tar Test>tar -cf out.tar c:/Tar Test/Text/t1.txt
tar: Cannot add file c:/Tar: No such file or directory
tar: Cannot add file Test/Text/t1.txt: No such file or directory
tar: Error exit delayed from previous errors
I've tried with the slashes both ways \ or / and with quotes around the full path no joy.
Thanks