kumar has asked for the wisdom of the Perl Monks concerning the following question:

Hi all,

I have a script written in perl and executed in the command prompt. While executing the script it works properly, but shows some error message.

Script:

system ` tar -cz /usr/fweb/xyz/abc > /usr/fweb/xyz/aa.tar.gz `;
This is fine - tar file is created, but getting this display as
"tar: Removing '/' from member names".
How can i eliminate this display?
Can anyone pls help me to tackle this problem.

update (broquaint): added formatting and marked off-topic

Replies are listed 'Best First'.
Re: tar: Removing '/' from member names
by Paladin (Vicar) on Feb 18, 2003 at 18:09 UTC
    The message tar: Removing '/' from member names is being output by tar to stderr. You can redirect stderr on the command like with something like this:
    tar -cz /usr/fweb/xyz/abc > /usr/fweb/xyz/aa.tar.gz 2> /dev/null

    The 2> redirects stderr the same way > redirects stderr. So the above command is telling the shell to send stderr to /dev/null which on most systems, just throws it away.

    Put that command in your `` in your script, and see if it works.

      Thanks lot for your help. It's working properly. Regards, kumar
Re: tar: Removing '/' from member names
by jmcnamara (Monsignor) on Feb 18, 2003 at 18:07 UTC

    This message comes from tar and not from perl.

    If you wish to keep the root "/" then have a look at the -P switch in the tar manpage:

    tar -Pcz /usr/fweb/xyz/abc > /usr/fweb/xyz/aa.tar.gz or tar -Pczf /usr/fweb/xyz/aa.tar.gz /usr/fweb/xyz/abc

    --
    John.

Re: tar: Removing '/' from member names
by feanor_269 (Beadle) on Feb 18, 2003 at 18:14 UTC
    You seem to be using linux or unix paths on a windows system... could that be the issue? or am I not seeing the real problem here?

    feanor_269
      You are not seeing the real issue here. It's a real tar warning, which has all to do with the content, and the euid of the person untarring it.

      The question itself has nothing to do with Perl though.

      Abigail