Thank you for your help

I didn't quite understand all that

Are these directories in the server or part of XF? And presumably that would tell me how many directories there were to know which number of directory to check? Also where do you run that code? Sorry for asking so many questions. And yes it is just the location I want to remove.
Sorry, there is always a degree of diving in headfirst once you start poking under the hood of software! Whilst I don't generally suggest you go poking around your install unless you feel comfortable (and well worth learning enough to be moderately comfortable). With modern control panels and so forth I forget how likely it is that some people may never have used a shell to access their server and deal with it directly.
The directories are generally within your Xenforo installation. So you normally have
data
and
internal_data
directories within each install, typically at the
root of your xenforo installation. Where that installation is will depend very much on your server setup and if you've not done that yourself you could try asking your provider although it's unlikely you're not using the standard layout.
Those two folders contain all your generated data, things like caches, attachments, etc. Attachments span over both directories. The thumbnails being in
data/attachments
and are publicly accessible (even those embedded in private messages), the actual attachments themselves are in
internal_data/attachments
.
To avoid there being too many files in those directories (imagine if you had thousands of attachments) the actual files are placed within numbered subdirectories. So if you wanted a copy of all your attachments to check locally you'd want to copy down the entire contents to the
internal_data/attachments
directory.
Both the attachments and their thumbnails are renamed from the file the user actually uploads. They are given an ID when added to the database (
data_id
) and this combined with an
MD5 checksum of the file, so each file looks something like:
6269-4c3e3cc924b72acc7bf11357fb1546a4
, in that example the data_id is
6269
, the rest is the MD5 hash of the file contents. Thumbnails have the file extension
.jpg
(although I guess on newer XF it may well be
.webp
), the actual attachment data has a
.data
extension (it's still an image file, but has been given a different file extension). The subdirectories are calculated from the
data_id
by taking the thousands element of the id, so the above example would be located in a directory named:
6
(ie [6269/1000] = 6), an ID of 100 would end up in a directory named
0
, etc. Directories are created by XF as needed as the number of attachments you have grows.
If you do download the actual attachment files (those with the
.data
extension) you will probably find you'll need to rename them so your operating system recognises them as images and lets you easily open them to check the metadata. I would suggest that's quite possibly the easiest way for you to check existing assets.