Copying Files with copy( ) : copy « File Directory « PHP






Copying Files with copy( )

 
<?
    $filename = 'data.txt';
    $filename2 = $filename . '.old';
    $result = copy($filename, $filename2);
    if ($result) {
            print "$filename has been copied to $filename2.\n";
    } else {
            print "Error: couldn't copy $filename to $filename2!\n";
    }
?>
  
  








Related examples in the same category

1.Copying a file
2.Copying files
3.Make a copy of a file: copy() function.
4.Using the copy() Function