DEV Community

Import Export by RockStarLab
Import Export by RockStarLab

Posted on

How to Export Only Selected Files from the WordPress Media Library

The problem with WordPress's default media export

If you've built anything on WordPress long enough, you know the built-in export tool (Tools → Export) is all-or-nothing. Pick "Media" and it exports the entire library — every image, PDF, and file ever uploaded — as one XML file.

That's fine for a full site migration. It's not fine when you're:

  • syncing a handful of files from staging to production
  • handing off media for a single client project
  • pulling files tied to one specific post or feature
  • building a small, focused CSV for review instead of a full audit

Doing a full export for any of these means bigger payloads, slower transfers, and a higher chance of hitting server timeouts on shared hosting — for files you probably didn't even need.

Selecting files instead of exporting everything

This is the gap Import Export by RockStarLab closes with its "Export Selected Media" workflow (PRO feature — new users get PRO free for a month). Instead of writing a filter and hoping it matches the right files, you select files directly in the Media Library UI you already use daily.

Here's the flow:

1. Select files in the Media Library

Go to Media → Library, switch to Bulk Select, and check the files you want. Nothing new to learn — it's the same interface you already use to manage media.

WordPress Media Library in Bulk Select mode with several files checked

An Export button appears once you've selected something.

2. Export opens with your selection pre-filtered

Clicking Export opens the plugin's export workflow, with your selected files already loaded as the filter. No rebuilding search queries, no re-selecting anything.

3. Choose which fields to export

You can export everything (ID, title, file URL, MIME type, size, width/height, upload date) or scope it down. Example of the kind of row you get in the output:

ID,Title,URL,Type,Size,Width,Height,Date
142,"product-hero.jpg","https://site.com/wp-content/uploads/2026/09/product-hero.jpg","image/jpeg",245678,1920,1080,"2026-09-01"
Enter fullscreen mode Exit fullscreen mode

Field selection screen showing available WordPress media fields for export

4. Export to CSV

CSV keeps the output portable — easy to diff, review in a spreadsheet, or pipe into another tool if you need to.

CSV export summary showing number of exported media files

Importing on the other side

On the destination site: Import Export by RockStarLab → Import, choose Media as the content type, upload the CSV. You get a preview of the first rows before committing — useful for a sanity check on a production site.

Since the CSV was generated by the same plugin, field mapping is one click (Auto Map) — no manual column matching. If you're importing a CSV from somewhere else, you can map fields by hand instead.

Auto Map screen matching CSV columns to WordPress media fields

Duplicate handling matters here. Matching by filename during import is the safest default — it prevents the same file from being imported twice if it already exists on the destination.

Import options screen with filename-based duplicate detection selected

Run the import, then check Media → Library on the destination to confirm the files landed correctly.

Full export vs. selected export vs. filtered export

Workflow Best for
Full media export Complete site migrations, full media audits
Selected media export Moving a manually picked set of files
Filtered media export Rule-based exports — by file type, size, or upload date

If you're scripting a repeatable migration (e.g. CI/CD between staging and prod), filtered export is usually a better fit than manual selection. Selected export is for the "I know exactly which 7 files I need" case.

A few things to watch for

  • Back up the destination site's database before importing into production.
  • Match by filename for duplicate detection unless you have a reason not to.
  • Review the destination Media Library after import — don't just trust the success message.
  • If you're doing this repeatedly, filters (by type/date/size) will save more time than manual selection.

Where to go from here

Full walkthrough with all the screenshots: Export Selected Files From the WordPress Media Library

Plugin (free, with a 1-month free PRO trial for this feature): Import Export by RockStarLab

If you've automated media migrations between WordPress sites some other way — WP-CLI, a custom script, anything — I'd like to hear about it in the comments.

Top comments (0)