Hi,
Please can anyone help me join 5 large (1.8gb) text files togeather
to create 1 very large file.
I have some code in PHP but it bombs out at 2gb (seems there is a limit
and php needs re compiling, something thats not an option for me)
I don't want to take up all the servers resources so something that uses
little memory would be very good indeed!
here's the php code if it help...
<?php
set_time_limit( 14400000);
$file[0] = "file1.txt" ;
$file[1] = "file2.txt" ;
$file[2] = "file3.txt" ;
$file[3] = "file4.txt" ;
$file[4] = "file5.txt" ;
$target = "output.txt ";
$handle = fopen($target, 'a');
foreach ($file as $var) {
$c_handle = fopen($var, 'r');
do {
$content = fread($c_handle ,1000000);
fwrite($handle, $content);
} while (!empty($conten t));
fclose($c_handl e);
}
?>
all the best
Stu
Please can anyone help me join 5 large (1.8gb) text files togeather
to create 1 very large file.
I have some code in PHP but it bombs out at 2gb (seems there is a limit
and php needs re compiling, something thats not an option for me)
I don't want to take up all the servers resources so something that uses
little memory would be very good indeed!
here's the php code if it help...
<?php
set_time_limit( 14400000);
$file[0] = "file1.txt" ;
$file[1] = "file2.txt" ;
$file[2] = "file3.txt" ;
$file[3] = "file4.txt" ;
$file[4] = "file5.txt" ;
$target = "output.txt ";
$handle = fopen($target, 'a');
foreach ($file as $var) {
$c_handle = fopen($var, 'r');
do {
$content = fread($c_handle ,1000000);
fwrite($handle, $content);
} while (!empty($conten t));
fclose($c_handl e);
}
?>
all the best
Stu
Comment