How to remove unused files from directories I want to remove/delete files from site directories (e.g. /sites/default/files/*) that are not used in site. There are thousands of files that causing fillup size. Any suggestions for this?
I found this post https://drupal.org/node/733258... may help...

The main purpose talked in this issue is about removing the images which doesn't have any use directly from database via SQL queries.

Audit files module is suggested as a good start (because doesn't delete files) to find files which are unused.

This code snippet is one of the suggested solution from the issue :

&lt;?php
//db_query to find all files not attached to a node:
$result = db_query("SELECT fid FROM file_managed WHERE NOT EXISTS (SELECT * FROM file_usage WHERE file_managed.fid = file_usage.fid) ");

//Delete file &amp; database entry
for ($i = 1; $i &lt;= $result-&gt;rowCount(); $i++) {
  $record = $result-&gt;fetchObject();
  $file = file_load($record-&gt;fid);
  if ($file != NULL) {
    file_delete($file);
  } }
?&gt;