in reply to Using an array, how do I search one directory area and copy to another area
You already mentioned in the CB that you're trying to use File::Find for that solution, and I really recommend it. The below skeleton should get you closer to your solution:
use strict; use File::Find; my $limit = 4 * 1024 * 1024 * 1024; my @source_directories = qw( ); my @files; File::Find::find( sub { push @files, $File::Find::name }, @source_dire +ctories ); my $total; my $basename = "part-"; my $count = 1; my $dirname = $basename . $count; for my $file (@files) { my $size = -s $file; if ($total + $size > $limit) { $total = 0; $count++; $dirname = $basename . $count; print "# 4GB Limit reached, starting new volume $dirname"; }; print "$file => $dirname/$file\n"; };
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Using an array, how do I search one directory area and copy to another area
by Tanktalus (Canon) on Mar 19, 2006 at 17:53 UTC |