I'm trying to implement gnu tar via a C# Windows service, which will create a archive which is to be transferred to a SCO unix box. However, when sco opens the archive, the filenames include the Windows drive notation and full path, eg. "C:/norris/bobbins.txt" rather than just "bobbins.txt"
Is there a way to just include the filename? Currently I'm just using "tar -cvf".
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Thanks Keith, I've never come across that one before. I wanted to avoid cygwin, because of previous problems (corporate mainly, rather than the software), but MSYS looks like an interesting alternative.
Any more suggestions will be appreciated. I'm thinking of including as many alternatives as possible, and allowing the particular tar method to be chosen via the app.config file.
Cheers,
Dave
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Thanks for the ICSharp link, but I'm already using that, and trying to replace it with gnu tar. We're processing huge numbers of records, and getting an intermittent error whereby a corrupt archive is created perhaps once a week. This causes a crash on a major nationwide system, which is somewhat serious. As I can't pinpoint any reason for the error, I'm just replacing the tar creation routine wholesale.
I can't CD to the directory as it's a Windows service. I can change the working directory, but that isn't configurable at runtime, which is a problem.
Thanks,
Dave
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Possibly MSYS, from www.mingw.org, would be more suited to your needs.
It includes an implementation of GNU tar, which works with a more POSIXy style path notation. Alternatively, since it also includes a bash shell, you could maybe exploit the power of *nix shell scripting from your Windows service; e.g. you could have it spawn:
sh.exe -c 'cd C:/wherever; tar cf archive .'
for a tar archive with relative paths.
HTH,
Keith.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I'm trying to implement gnu tar via a C# Windows service, which will create a archive which is to be transferred to a SCO unix box. However, when sco opens the archive, the filenames include the Windows drive notation and full path, eg. "C:/norris/bobbins.txt" rather than just "bobbins.txt"
Is there a way to just include the filename? Currently I'm just using "tar -cvf".
Thanks Keith, I've never come across that one before. I wanted to avoid cygwin, because of previous problems (corporate mainly, rather than the software), but MSYS looks like an interesting alternative.
Any more suggestions will be appreciated. I'm thinking of including as many alternatives as possible, and allowing the particular tar method to be chosen via the app.config file.
Cheers,
Dave
Perhaps first cd'ing into C:\Norris before creating the archive, results in the desired behavior.
I have no idea why I am getting alerts for this forum but... have you seen
http://www.icsharpcode.net/OpenSource/SharpZipLib/Default.aspx
It may do what you want already.
Cheers
Antoine
Thanks for the ICSharp link, but I'm already using that, and trying to replace it with gnu tar. We're processing huge numbers of records, and getting an intermittent error whereby a corrupt archive is created perhaps once a week. This causes a crash on a major nationwide system, which is somewhat serious. As I can't pinpoint any reason for the error, I'm just replacing the tar creation routine wholesale.
I can't CD to the directory as it's a Windows service. I can change the working directory, but that isn't configurable at runtime, which is a problem.
Thanks,
Dave
Possibly MSYS, from www.mingw.org, would be more suited to your needs.
It includes an implementation of GNU tar, which works with a more POSIXy style path notation. Alternatively, since it also includes a bash shell, you could maybe exploit the power of *nix shell scripting from your Windows service; e.g. you could have it spawn:
sh.exe -c 'cd C:/wherever; tar cf archive .'
for a tar archive with relative paths.
HTH,
Keith.