Each time I delete a media entry in Gramps I also have to manually delete the corresponding file on my media folder.
a) Is there a way to delete media files directly from Gramps?
b) Since there are probably a lot of unused media files on my media folder, is there any way to identify them?
I am glad that a delete within Gramps does not make the corresponding delete in my OS files/folders.
That being said, how to identify extra media files.
An option is to use the addon Media Verify tool. It works off of the file’s checksum which is stored in Gramps. For a first step, I would use the Generate option. This will make sure the checksum agrees between what Gramps has stored and the raw file. If a file is missing, it will let you know.
Then you can run the Verify option. The tool will scan all the files in your Base Media Path and the Media records within Gramps. If any of the files have been moved or renamed the Fix option will update the record’s path field. (A great tool when you need/want to reorganize the files and their folders.)
Also generated will be a list of all of the extra files found in the folders that are not in Gramps. You would need to manually move or delete the files on your hard drive.
There is another option that I first started to detail but then remembered there was an issue and now remember the fix.
You can create an Export. Use the setting Gramps (XML) Package (family tree and media)
When you get to the Option page make sure that all people (including living) are included. But on the Reference Filter make sure that you set it to Do not include records not linked to a selected person. This will limit the Media files to just files Gramps is looking for.
Once the export is created, you can delete (I would move) the raw files and their folders.
Then you can create a new database/tree and import the file you just created.
NOTE: When the media are extracted, Gramps often has a problem putting them in the desired folder. Often Gramps will extract them to a folder in your Personal Folder. (Win10 c:\users\%user%\). It would be a simple task to move the files to the desired folder.
Once the media is in their location, go back to your main, original, database tree and use the Verify tool to make sure everything is to your satisfaction. Then I would delete the database tree that was created from the import. By limiting References in the export, other records from your main database may have been omitted. But the Reference filter is the only way to limit the Media records.