Skip to content
Snippets Groups Projects
Commit c59be8a1 authored by Gerhard Gonter's avatar Gerhard Gonter :speech_balloon:
Browse files

only write 1000 filenames into the batch list so that xargs has a chance to...

only write 1000 filenames into the batch list so that xargs has a chance to write them into one command line
parent 342907be
Branches
No related tags found
No related merge requests found
...@@ -280,12 +280,34 @@ elsif ($op_mode eq 'policy') ...@@ -280,12 +280,34 @@ elsif ($op_mode eq 'policy')
foreach my $d_repo (sort keys %$s) foreach my $d_repo (sort keys %$s)
{ {
my @s_paths= sort @{$s->{$d_repo}}; my @s_paths= sort @{$s->{$d_repo}};
my $part= 0;
my $fo_open= 0;
my $items= 0;
if (open (FO_COPY, '>:utf8', join ('_', '@copy', $s_repo, 'to', $d_repo))) foreach my $p (@s_paths)
{ {
foreach my $p (@s_paths) { print FO_COPY $p, "\0" } unless ($fo_open)
close (FO_COPY); {
my $fnm= join ('_', '@copy', $s_repo, 'to', $d_repo, 'part', ++$part);
unless (open (FO_COPY, '>:utf8', $fnm))
{
printf STDERR "can't write to '$fnm'\n";
exit;
}
print "writing items to '$fnm'\n";
$fo_open= 1;
}
print FO_COPY $p, "\0";
$items++;
if ($items >= 1000) # TODO: parametrize
{
close (FO_COPY);
$items= 0;
$fo_open= 0;
}
} }
close (FO_COPY) if ($fo_open);
} }
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment