WP_Filesystem_Direct::copy() – Copies a file.

You appear to be a bot. Output may be restricted

Description

Copies a file.

Usage

$bool = WP_Filesystem_Direct::copy( $source, $destination, $overwrite, $mode );

Parameters

$source
( string ) required – Path to the source file.
$destination
( string ) required – Path to the destination file.
$overwrite
( bool ) optional – Optional. Whether to overwrite the destination file if it exists. Default false.
$mode
( int|false ) optional – Optional. The permissions as octal number, usually 0644 for files,

  1. for dirs. Default false.

Returns

bool True on success, false on failure.

Source

File name: wordpress/wp-admin/includes/class-wp-filesystem-direct.php
Lines:

1 to 13 of 13
  public function copy( $source, $destination, $overwrite = false, $mode = false ) {
    if ( ! $overwrite && $this->WP_Filesystem_Direct::exists( $destination ) ) {
      return false;
    }

    $rtval = copy( $source, $destination );

    if ( $mode ) {
      $this->WP_Filesystem_Direct::chmod( $destination, $mode );
    }

    return $rtval;
  }
 

 View on GitHub View on Trac