Can we search and find the big attachments?

Your see, the server I rented is not very bid. And I find people like to upload attachments in the discourse. I have already set the maximum size of the attachments, while still the discourse Backup file is still too big.

Is it possible that I can search for the big attachments(say bigger than 10 M) and I can delete the attachment.


This would be a very useful canned data explorer query @rishabh.


If you’re OK with those links being broken, you can use the Unix find command to locate them in the uploads directory. Something like linux - Use 'find' to find and delete large files of a certain type - Super User


Is the upload folder


There are 2 subfolders in the “upload” folder, can I just delete things in the 2 subfolders?

Anyway, I still fell it too “dangerous” to delete things in this way.

1 Like


You’re breaking things on purpose, here.

You can see what would happen like this:

find /var/discourse/shared/standalone/uploads -type f -size +50000k -exec ls -lh {} \;

That’ll just list the files.

I’d recommend that you just leave them. It’s probably not that much space.


I wouldn’t be so concerned about how much space they’re taking up without considering their potential usefulness.

For example, if a topic had been archived, unlisted and had not been visited in a long time (i.e. the chances anyone might still be interested in the attachment are extremely rare) then I guess it might be OK to delete them. It would probably only impact members that were using the forum for long term file storage.

1 Like

The word dangerous I mentioned is not I’m afraid of deleting the attachments, I’m actually afraid of miss deleting other files eapecially some system components that will kill the discourse system. If I can delete these attachments one by one, I will delete them.

Only uploads are in the uploads directory.

You’ll want to make a backup. :slight_smile:

1 Like

The default query for it was added in and it looks like this: