Menu

Tar for Windows (excluding C:\, D:\) notation

Help
2005-12-07
2012-07-26
  • Nobody/Anonymous

    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".

     
    • Nobody/Anonymous

      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

       
    • Nobody/Anonymous

      Perhaps first cd'ing into C:\Norris before creating the archive, results in the desired behavior.

       
    • Antoine

      Antoine - 2005-12-11

      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

       
    • Nobody/Anonymous

      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

       
      • Keith Marshall

        Keith Marshall - 2005-12-12

        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.

         
MongoDB Logo MongoDB