Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > Perl Misc > Tar on Windows XP

Reply
Thread Tools

Tar on Windows XP

 
 
David Walker
Guest
Posts: n/a
 
      01-29-2007
Hi

I am trying to create a tar archive on Windows XP with the Perl code below.
However, when I look at the archive created (using WinZip 10.0) all the
directory information is lost, and when I untar it using WinZip all I get is
all the files in the same directory. Can some kind person please tell me how
I can create the tar file so that when it is untar'd the directory
structure will be preserved.

Thanks
David

use Archive::Tar;
use IO::Zlib;
use File::Find;

$dir = "c:/docume~1/david/somedir";
$archive = "c:/docume~1/david/archive.tar";
$tar = Archive::Tar->new;

(@files);
find(\&wanted, $dir);
$tar->add_files(@files);
$tar->write($archive);

sub wanted{
push(@files,$File::Find::name);
}


 
Reply With Quote
 
 
 
 
Sisyphus
Guest
Posts: n/a
 
      01-30-2007

"David Walker" <(E-Mail Removed)> wrote in message
news:Gxuvh.18350$(E-Mail Removed)...
> Hi
>
> I am trying to create a tar archive on Windows XP with the Perl code
> below. However, when I look at the archive created (using WinZip 10.0) all
> the directory information is lost, and when I untar it using WinZip all I
> get is all the files in the same directory. Can some kind person please
> tell me how I can create the tar file so that when it is untar'd the
> directory structure will be preserved.
>


From the "FAQ" section in 'perldoc Archive::Tar' :

-- quote --
I'm using WinZip, or some other non-POSIX client, and files are not
being extracted properly!
By default, "Archive::Tar" is in a completely POSIX-compatible mode,
which uses the POSIX-specification of "tar" to store files. For
paths greather than 100 characters, this is done using the "POSIX
header prefix". Non-POSIX-compatible clients may not support this
part of the specification, and may only support the "GNU Extended
Header" functionality. To facilitate those clients, you can set the
$Archive::Tar:O_NOT_USE_PREFIX variable to "true". See the "GLOBAL
VARIABLES" section for details on this variable.
-- end quote --

Hopefully, that deals with the problem you're facing. (If not, let us know -
and also tell us which version of Archive::Tar you have.).)

Cheers,
Rob


 
Reply With Quote
 
 
 
 
David Walker
Guest
Posts: n/a
 
      01-30-2007
Rob

Yes that worked! I was using Tar 1.07, which didn't have the
DO_NOT_USE_PREFIX feature, so I've now installed Tar 1.30.

Thanks for your help.

David

"Sisyphus" <(E-Mail Removed)> wrote in message
news:45bec765$0$9776$(E-Mail Removed) ...
>
> "David Walker" <(E-Mail Removed)> wrote in message
> news:Gxuvh.18350$(E-Mail Removed)...
>> Hi
>>
>> I am trying to create a tar archive on Windows XP with the Perl code
>> below. However, when I look at the archive created (using WinZip 10.0)
>> all the directory information is lost, and when I untar it using WinZip
>> all I get is all the files in the same directory. Can some kind person
>> please tell me how I can create the tar file so that when it is untar'd
>> the directory structure will be preserved.
>>

>
> From the "FAQ" section in 'perldoc Archive::Tar' :
>
> -- quote --
> I'm using WinZip, or some other non-POSIX client, and files are not
> being extracted properly!
> By default, "Archive::Tar" is in a completely POSIX-compatible
> mode,
> which uses the POSIX-specification of "tar" to store files. For
> paths greather than 100 characters, this is done using the "POSIX
> header prefix". Non-POSIX-compatible clients may not support this
> part of the specification, and may only support the "GNU Extended
> Header" functionality. To facilitate those clients, you can set the
> $Archive::Tar:O_NOT_USE_PREFIX variable to "true". See the
> "GLOBAL
> VARIABLES" section for details on this variable.
> -- end quote --
>
> Hopefully, that deals with the problem you're facing. (If not, let us
> know - and also tell us which version of Archive::Tar you have.).)
>
> Cheers,
> Rob
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: Pipelining tar create and tar extract the "Python" way... Ray Van Dolson Python 0 09-25-2009 03:48 PM
Pipelining tar create and tar extract the "Python" way... Ray Van Dolson Python 0 09-23-2009 10:52 PM
os.system('tar -c * | tar -C dst') ##Any other suggestions... list.repository@gmail.com Python 2 04-24-2007 10:29 PM
Version of TAR in tarfile module? TAR 1.14 or 1.15 port to Windows? Claudio Grondi Python 4 08-20-2005 08:01 PM
trouble with Archive::Tar : Can not read compressed format in tar-mode benoit Guyon Perl Misc 2 07-26-2005 01:53 PM



Advertisments