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.

2 Likes

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

3 Likes

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

3 Likes

Is the upload folder

/var/discourse/shared/standalone/uploads

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

Yes.

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.

2 Likes

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 https://github.com/discourse/discourse-data-explorer/commit/931bbb67a07a57965c3da8ca471ee2283eeb1f27 and it looks like this:

6 Likes