How to delete files from public folder?
file_delete deletes a file where it is located and its database record also.

First check file_load whether it is rendering an object file.

// load the file
$file = file_load('YOUR_FILE_ID');

// delete file from disk and from database
file_delete($file);


The file_delete() also takes a second argument $force that if set to TRUE will remove the file even if it's reported as in use by the file_usage table.

use drupal_unlink($fullpath) if files are not recorded in the file_managed table and file_usage table.

See this