blob: dd62c18ffa17faaf47dcb799518a17a5312785ec (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
|
#!/usr/bin/perl -w
use strict;
my $maxsize = 660 * 1024 * 1024;
my $read = 1024*1024;
my $size = 1024*1024;
my $filenum = "1";
my $count = 0;
my ($fi,$data);
$fi = sprintf ("part%d",$filenum);
open (FI,">$fi");
while ($read == $size)
{
if ($count < $maxsize)
{
$read = read (STDIN,$data,$size);
print FI $data;
$count += $size;
$a = $count /1024/1024;
if ($a % 10 == 0) {
print STDERR "File: $filenum Size: ${a}MB\n";
}
}
else
{
close (FI);
$filenum++;
$fi = sprintf ("part%d",$filenum);
open (FI,">$fi");
$count = 0;
}
}
close FI;
|