Reinstall WordPress while keeping attachments

Depending on how those inbound links work, this could be simpler than you think.

If the links are direct to files in the file system, WordPress isn’t actually needed at all – just a corresponding path for a valid URL.

So let’s say you install WP today, the ‘earliest’ folder in uploads will be 2020/09. If you setup WP as normal and simply copy in the 2020/07 folder from your previous install, the files will be accessible to external visitors as normal. WP will not overwrite that folder as the writing of files is based on upload date (by default). It can’t go back in time (without a hack).

The problem comes if their links are to attachment pages, rather than the attachments themselves. In that case, I think the simplest and most manageable option is actually to setup some redirects in htaccess. Then create new attachments in your new WP install and redirect old path to new.