login about faq

I would like to tar up the relative path along with the information. For example, using the standard tar command: tar -cvf my.tar vpm1/dm1. This would include the relative path vpm1/dm1 on each item being tarred up, for example:

vpm1/dm1/calgrp1/myfile.txt vpm1/dm1/calgrp2/myfile.txt ...

When using CkTar, and using the addDirRoot(c:/vmpl1/dm1), the contents ends up as: calgrp1/myfile.txt calgrp2/myfile.txt

There is a "method" call dirPrefix() that seems to be a solution, but I don't understand how it can be used since it does not take an argument (i.e. mytar.dirPrefix("vpm1/dm1").

My only other option is to use the path as part of the tar file, i.e. vpm1_dm1.tar and parse the filename before restoring.

Any ideas?

Thanks.

asked Nov 07 '12 at 09:03

concord's gravatar image

concord
16225


DirPrefix is a property. In Chilkat's C++ API, string properties have two forms for the getter, and one for the setter:

    void get_DirPrefix(CkString &str);
    const char *dirPrefix(void);
    void put_DirPrefix(const char *newVal);

To set the DirPrefix, call put_DirPrefix. In the case you described above, you would want to set the DirPrefix equal to "vpm1/dm1/".

(To include multiple directory trees in a single TAR archive, call AddDirRoot once per directory tree. The DirPrefix will apply to all.)

link

answered Nov 07 '12 at 09:29

chilkat's gravatar image

chilkat ♦♦
11.8k316358421

edited Nov 07 '12 at 09:29

Thanks, that works. I was reading from the online docs and it didn't mention the getXXX / putXXX methods.

link

answered Nov 09 '12 at 15:36

concord's gravatar image

concord
16225

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or __italic__
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×17

Asked: Nov 07 '12 at 09:03

Seen: 1,047 times

Last updated: Nov 09 '12 at 15:36

powered by OSQA