WordPress at Your Fingertips
function is not described

WP_Filesystem_ftpsockets::copy() public WP 2.5.0

Copies a file.

{} It's a method of the class: WP_Filesystem_ftpsockets{}

No Hooks.


true|false. True on success, false on failure.


$WP_Filesystem_ftpsockets = new WP_Filesystem_ftpsockets();
$WP_Filesystem_ftpsockets->copy( $source, $destination, $overwrite, $mode );
$source(string) (required)
Path to the source file.
$destination(string) (required)
Path to the destination file.
Whether to overwrite the destination file if it exists.
Default: false
The permissions as octal number, usually 0644 for files,
0755 for dirs.
Default: false


Since 2.5.0 Introduced.

Code of WP_Filesystem_ftpsockets::copy() WP 5.8.2

public function copy( $source, $destination, $overwrite = false, $mode = false ) {
	if ( ! $overwrite && $this->exists( $destination ) ) {
		return false;

	$content = $this->get_contents( $source );

	if ( false === $content ) {
		return false;

	return $this->put_contents( $destination, $content, $mode );