Beefy Boxes and Bandwidth Generously Provided by pair Networks RobOMonk
Perl Monk, Perl Meditation
 
PerlMonks  

Re^2: tar help

by snyder (Initiate)
on Mar 21, 2006 at 16:48 UTC ( [id://538320]=note: print w/replies, xml ) Need Help??

This is an archived low-energy page for bots and other anonmyous visitors. Please sign up if you are a human and want to interact.


in reply to Re: tar help
in thread tar help

I have already achieved success with your first 3 recommendations. What I did find useful was your advice on the IO::Dir with the code below I can print to screen the files I wish to tar.
#!/usr/bin/perl use IO::Dir; tie %dir, 'IO::Dir', "/var/lib/mysql/club"; foreach (keys %dir) { print $_, " " ,"\n"; }
how would I use this to achieve my objective?

Replies are listed 'Best First'.
Re^3: tar help
by derby (Abbot) on Mar 22, 2006 at 07:35 UTC
    my @files; tie %dir, 'IO::Dir', "/var/lib/mysql/club"; foreach (keys %dir) { next if $_ eq "."; next if $_ eq ".."; push( @files, "/var/lib/mysql/club/" . $_ ); } my $tar = Archive::Tar->new; $tar->add_files( @files ); $tar->write('club_db.tar');

    but .... don't forget to check for errors

    -derby
      thanks, it is throwing an error but I am going to monkey with it. in an effort to understand the code piece by piece did you create an empty list/variable with the below
      my @files;

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://538320]
help
Sections?
Information?
Find Nodes?
Leftovers?
    Notices?
    hippoepoptai's answer Re: how do I set a cookie and redirect was blessed by hippo!
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.