On this page
WP_Filesystem_FTPext::exists( string $path ): bool
Checks if a file or directory exists.
Parameters
$pathstring Required-
Path to file or directory.
Return
bool Whether $path exists or not.
Source
File: wp-admin/includes/class-wp-filesystem-ftpext.php. View all references
public function exists( $path ) {
if ( $this->is_dir( $path ) ) {
return true;
}
return ! empty( ftp_rawlist( $this->link, $path ) );
}
Related
Uses
| Uses | Description |
|---|---|
| WP_Filesystem_FTPext::is_dir() wp-admin/includes/class-wp-filesystem-ftpext.php | Checks if resource is a directory. |
Used By
| Used By | Description |
|---|---|
| WP_Filesystem_FTPext::is_file() wp-admin/includes/class-wp-filesystem-ftpext.php | Checks if resource is a file. |
| WP_Filesystem_FTPext::copy() wp-admin/includes/class-wp-filesystem-ftpext.php | Copies a file. |
Changelog
| Version | Description |
|---|---|
| 6.1.0 | Uses WP_Filesystem_FTPext::is_dir() to check for directory existence and ftp_rawlist() to check for file existence. |
| 2.5.0 | Introduced. |
© 2003–2022 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/classes/wp_filesystem_ftpext/exists