WP_Filesystem_FTPext::delete( string $file, bool $recursive = false, string $type = false )


Parameters

$file

(Required)

$recursive

(Optional)

Default value: false

$type

(Optional)

Default value: false


Return

(bool)


Source

File: wp-admin/includes/class-wp-filesystem-ftpext.php

	public function delete($file, $recursive = false, $type = false) {
		if ( empty($file) )
			return false;
		if ( 'f' == $type || $this->is_file($file) )
			return @ftp_delete($this->link, $file);
		if ( !$recursive )
			return @ftp_rmdir($this->link, $file);

		$filelist = $this->dirlist( trailingslashit($file) );
		if ( !empty($filelist) )
			foreach ( $filelist as $delete_file )
				$this->delete( trailingslashit($file) . $delete_file['name'], $recursive, $delete_file['type'] );
		return @ftp_rmdir($this->link, $file);
	}