Jas wrote:
>
> Not sure if this is the way it is supposed to work, but I am not sure
> how I can get a directory, like a web directory backed up in one step
> using Archive::Tar.
>
> Code...
>
> #!/usr/bin/perl
>
> use strict;
> use Archive::Tar;
>
> my $bu = Archive::Tar->create_archive("www.tar",0,glob("/path/to/www/*"));
>
> This only grabs files under www/, it doesn't touch the directories.  I
> am still new to perl and have been looking at the Archive::Tar
> documentation on Cpan but it doesn't give an example of how this can be
> accomplished.  Any help is appreciated.

Hi Jas.

This being a beginners' group I'm replying with some information and a
question instead of a straight answer. Beware that I know almost nothing
about Archive::Tar.

  glob "/path/to/www/*"

will return a list of filenames that match the wildcard. It's likely
that create_archive() will only look at the first of that list, which is
more than likely to be 'dot' (the current directory). So you are calling
the equivalent of

  my $bu = Archive::Tar->create_archive('www.tar', 0, '/path/to/www/.')

(I suggest you use single quotes for any string that doesn't involve
control characters or interpolated variables.)

If you need someone to read

  perldoc Archive::Tar

for you, then come back: we never fail in the end :)

Rob




-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to