Title: WP_Filesystem_FTPext::move
Published: April 25, 2014
Last modified: May 20, 2026

---

# WP_Filesystem_FTPext::move( string $source, string $destination, bool $overwrite = false ): bool

## In this article

 * [Description](https://developer.wordpress.org/reference/classes/wp_filesystem_ftpext/move/?output_format=md#description)
 * [Parameters](https://developer.wordpress.org/reference/classes/wp_filesystem_ftpext/move/?output_format=md#parameters)
 * [Return](https://developer.wordpress.org/reference/classes/wp_filesystem_ftpext/move/?output_format=md#return)
 * [Source](https://developer.wordpress.org/reference/classes/wp_filesystem_ftpext/move/?output_format=md#source)
 * [Changelog](https://developer.wordpress.org/reference/classes/wp_filesystem_ftpext/move/?output_format=md#changelog)

[ Back to top](https://developer.wordpress.org/reference/classes/wp_filesystem_ftpext/move/?output_format=md#wp--skip-link--target)

Moves a file or directory.

## 󠀁[Description](https://developer.wordpress.org/reference/classes/wp_filesystem_ftpext/move/?output_format=md#description)󠁿

After moving files or directories, OPcache will need to be invalidated.

If moving a directory fails, `copy_dir()` can be used for a recursive copy.

Use `move_dir()` for moving directories with OPcache invalidation and a fallback
to `copy_dir()`.

## 󠀁[Parameters](https://developer.wordpress.org/reference/classes/wp_filesystem_ftpext/move/?output_format=md#parameters)󠁿

 `$source`stringrequired

Path to the source file or directory.

`$destination`stringrequired

Path to the destination file or directory.

`$overwrite`booloptional

Whether to overwrite the destination if it exists.

Default:`false`

## 󠀁[Return](https://developer.wordpress.org/reference/classes/wp_filesystem_ftpext/move/?output_format=md#return)󠁿

 bool True on success, false on failure.

## 󠀁[Source](https://developer.wordpress.org/reference/classes/wp_filesystem_ftpext/move/?output_format=md#source)󠁿

    ```php
    public function move( $source, $destination, $overwrite = false ) {
    	return ftp_rename( $this->link, $source, $destination );
    }
    ```

[View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/class-wp-filesystem-ftpext.php/)
[View on Trac](https://core.trac.wordpress.org/browser/tags/7.0/src/wp-admin/includes/class-wp-filesystem-ftpext.php#L378)
[View on GitHub](https://github.com/WordPress/wordpress-develop/blob/7.0/src/wp-admin/includes/class-wp-filesystem-ftpext.php#L378-L380)

## 󠀁[Changelog](https://developer.wordpress.org/reference/classes/wp_filesystem_ftpext/move/?output_format=md#changelog)󠁿

| Version | Description | 
| [2.5.0](https://developer.wordpress.org/reference/since/2.5.0/) | Introduced. |

## User Contributed Notes

You must [log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fclasses%2Fwp_filesystem_ftpext%2Fmove%2F)
before being able to contribute a note or feedback.