Looks nice...a module that simply deletes all unused files.

But when I install the module and run the option to delete all unused files, the module does not find unused files. But there are! Don't know what I might do wrong because there is not much to do besides installing the module.

Comments

labboy0276’s picture

Assigned: Unassigned » labboy0276
Priority: Normal » Minor

Hello!

Your files may not be unattached from the nodes themselves, run this in your mysql CLI against the instance to see:

SELECT fm.* FROM file_managed AS fm LEFT OUTER JOIN file_usage AS fu ON (fm.fid = fu.fid) LEFT OUTER JOIN node AS n ON (fu.id = n.nid) WHERE fu.type = 'node' AND n.nid IS NULL

labboy0276’s picture

Status: Active » Fixed

So, I thought about it and what I was doing was just deleting the orphaned files. Not technically the unmanaged files. So I just pushed up beta3 which adds a new tab that will delete all files in your files directory that are not in the file_managed table.

Go ahead and upgrade and see if that does the trick.

labboy0276’s picture

Status: Fixed » Closed (fixed)
ecvandenberg’s picture

Thanks for your update. But the new option is a bit too rough. It really deletes all unmanaged files. Thus also files that are generated and used by templates. Like the sites/default/files/color/bartik-... folder when using the bartik theme.

Perhaps I don't understand the module enough. I have the following use case:

  • I have an unused image file in the sites/default/files directory. I just placed that image there with FTP.
  • When using the Delete Orphaned files, no files are found. That I don't understand.
  • And I don't understand how to use the FID (which I think is the File Identifier. What is that?

When I think it over it is not so easy obviously. I guess what is needed is that the user can select folders. Then the module presents a list with files it wants to delete. The user can then select which files to skip.
But that is perhaps too complicated. But the fact is that I have some websites that have lots of images in the files directory that are not used anymore. And I was hoping for some magical module :-)

labboy0276’s picture

I understand where you are coming from and I thought of that as well. My next step in the module was to give a view of what is unmanaged and then the option to select and delete those files. By all standards, if the system doe not register the files, then they are technically unmanaged. Remember this is still a beta module and has a little more work to be done on it. The module is still magical and you are always welcome to submit patches to make it better.

Markiz’s picture

Hello, thank you very much for this great module. I migrated content from D6 to D7 and there are many not used files in files directory.

In "Info" section of your module, there are many "not attached" files, which should be deleted. Could you please add exposed filter to list view for me to be able to select just these files and delete them? In other tabs "manual", "orphaned" and "unmanaged", module finds no files.

Thanks again for this fine module.

labboy0276’s picture

@markiz, the changes you requested are in the dev branch. I will work on this more in the next week or so and release another beta version as well.