How to delete folder along with the files from database also?
file_unmanaged_delete_recursive(), as the name implies, removes any files under a directory without concern to managed files (i.e. files tracked in the database). 

In order to remove files from the database, you can make use of the file_delete() function in the File API. This function needs the file ID supplied as an argument, so you'll need to perform a query on the database to retrieve it. For example:

$files = file_scan_directory('sites/default/files/my_custom_dir', '/.*/', array('recurse' =&gt; TRUE));
foreach($files as $file) { 
  $scanned_file_uri = file_build_uri($file-&gt;uri); 
  // @TODO: query file_managed.uri for match with $scanned_file_uri
  // then delete with file_delete();
}