Modified implementation of copy to support the reading of large files.