Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re^2: Creating a tarball

by Aldebaran (Curate)
on Feb 10, 2019 at 08:35 UTC ( [id://1229698]=note: print w/replies, xml ) Need Help??


in reply to Re: Creating a tarball
in thread Creating a tarball

Fuller version (still untested)

I was happy to see your post using Path::Tiny's visit method. This works well for me:

$ ./2.visit.pl 1.mu69 1.Плутон
argv is 1.mu69 1.Плутон
$ cat 2.visit.pl 
#!/usr/bin/perl -w
use 5.016;
use Archive::Tar;
use Path::Tiny;

say "argv is @ARGV";
my $tar = Archive::Tar::->new();
my @filenamelist;

foreach (@ARGV) {

path("$_")->visit(
  sub { -f || -d and push @filenamelist, "$_" },
  {recurse => 1}
  );
$tar->add_files(@filenamelist);
}
$tar->write("/home/bob/Desktop/1.files.tar.gz", COMPRESS_GZIP);
__END__ 
$ 

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1229698]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others lurking in the Monastery: (5)
As of 2024-04-19 12:47 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found