Simple Machines Community Forum

SMF Support => SMF 2.0.x Support => Topic started by: X3mE on October 29, 2008, 09:31:19 PM

Title: Check which attachment files are not used
Post by: X3mE on October 29, 2008, 09:31:19 PM
Is there a way for me to check which files in the attachments folder are not used as attachments?
Title: Re: Check which attachment files are not used
Post by: N3RVE on November 01, 2008, 06:54:31 AM
Hello, X3mE :)
I couldn't find a way to remove attachments that aren't linked with posts but I will be looking more into this shortly. Currently, you can perform maintenance to remove old attachments and/or attachments larger than a specified size.
Admin CP -> Forum -> Attachments and Avatars -> File maintenance.

-[n3rve]
Title: Re: Check which attachment files are not used
Post by: X3mE on November 01, 2008, 09:03:26 AM
Thank you, I hope you'll find a solution :)
Title: Re: Check which attachment files are not used
Post by: Rumbaar on November 10, 2008, 05:30:34 AM
Well all things being equal there shouldn't be any orphan files.  As once you delete them they are deleted from the folder.

As the database holds what is in use, there is no real way to check the other way.  I know there was a post I responded too many months ago with the same question and a few ideas and limits to what was possible.  Due to the nature of attachment storage and 'encryption' of filenames.
Title: Re: Check which attachment files are not used
Post by: X3mE on November 10, 2008, 08:55:46 AM
Let me explain what happened... I have switched to a new server, and uploaded everything but the attachments folder (as they take a lot of space, and my upload speed is slow), and then, while uploading them, one of the users didn't see my note about attachments not working currently, and reuploaded a few he posted earlier. So, when the upload had finished, I practically had a few "double" files, that is a few files not used as attachments. They are only a couple of MB big, nothing to worry about, I just asked if there's a sophisticated way to check which files in that folder are not used.
Title: Re: Check which attachment files are not used
Post by: Rumbaar on November 10, 2008, 03:40:36 PM
Not that I'm aware of sorry, a very manual process and possibly impossible if you have filename encryption on.  Maybe guess work and date/timestamp checking.