Hi Monks,
I would like to know the best way to append a file (huge,in Terra bytes) to another file.
Both source and destination could be of Terrabytes in Size.
As of now, am usinguse File::Copy; open ( my $s, "<", "source" ) or die "Could not open source file: $!\n +"; open ( my $d , ">>", "dest" ) or die "Could not open destination file +: $!\n"; copy($s, $d) or die "Could not copy source to dest : $!\n"; (close $s && close $d ) or die "Could not close file handles : $!\n";
But some time, the above code says "Could not close file Input/Output error", and destination file is corrupted. I've noticed the line Note that passing in files as handles instead of names may lead to loss of information on some operating systems; it is recommended that you use file names whenever possible. from http://search.cpan.org/~rjbs/perl-5.16.0/lib/File/Copy.pm
Am not sure, whether passing file handle to copy is causing this issue.
Finally, I would want to know the right and best way to append a to another file with out consuming memory.
Thanks in Advance.In reply to Best way to append bigger files by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |