Still thinking about a solution…
I created a wizard performing the following steps :
- Retrieves every model/field having the binary type. eg :
Pool().get('ir.model.field').search(['ttype','=','binary'])
- Parse every record for each model/field having the attribute
file_id
, record the content in a Set - Parse every file in the FileStore directory. If not in the set, delete it.
I’m still uneasy with the transactional pitfalls, but if my procedure is triggered when no user is connected, it would be fine ?
Also, I’m aware this solution only works for the stadard FileStore. Maybe file operations (listing, deleting) should be implemented at this object level…
Any chance I still misunderstand something and screw my files ?