@gappiah the solution of just copying the directory with media files does not work. Browsing in this forum and elsewhere, I read about databases that need to be updated. I see all kinds of SQL-queries that I do not understand.
It surely does work, as per the question you asked. But maybe not what you expect.
So the problem may be in the specific question you asked.
First, some background info:
When you upload a file in WordPress, certain metadata about the file is stored in the WordPress database. If you use the file (say image) in a post, additional metadata are added.
Part of this metadata is what makes the files browsable in the Media library in the WordPress dashboard.
What this means is that the files you upload from the WordPress dashboard are linked to the WordPress database of the specific WordPress site.
What this also means is that… even on your current WordPress site… if you use, say, FTP, to upload files to the WordPress uploads folder, WordPress will not be “aware” of these files… therefore they will not appear in the Media library.
Now, let’s get back to your ORIGINAL question:
How can I export all media, so I can import them again in a fresh WP-site?
My understanding was that you wanted just the media files to use on a new (and different) WordPress site. This is exactly what the plugin I recommended does.
But, as noted earlier, because we’re dealing with a new and different WordPress site/database that’s not aware of the files… if you simply upload these files via FTP to your uploads folder, the files will NOT appear in the Media library.
There are solutions to this specific problem, but I’m not entirely sure if this is the problem you’re trying to solve or not.
So kindly clarify this for me:
Is this “fresh WP-site” a new and different WordPress site you’re building (ie you’re not using the existing site’s content/database on the new site)?
Or, are you simply migrating the existing site’s content/database and files to the new site?
What are you really doing?
Standing by.