WordPress at a glance
function is not described

wp_delete_file_from_directory() WP 4.9.7

Deletes a file if its path is within the given directory.

No Hooks.

Return

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

Usage

wp_delete_file_from_directory( $file, $directory );
$file(string) (required)
Absolute path to the file to delete.
$directory(string) (required)
Absolute path to a directory.

Code of wp delete file from directory: wp-includes/functions.php VER 5.1.1

<?php
function wp_delete_file_from_directory( $file, $directory ) {
	$real_file      = realpath( wp_normalize_path( $file ) );
	$real_directory = realpath( wp_normalize_path( $directory ) );

	if ( false === $real_file || false === $real_directory || strpos( wp_normalize_path( $real_file ), trailingslashit( wp_normalize_path( $real_directory ) ) ) !== 0 ) {
		return false;
	}

	wp_delete_file( $file );

	return true;
}