Plan the media part of a WordPress migration
A WXR content export contains attachment references, not the media files themselves. This offline toolkit lists attachment URLs and flags duplicate, missing or invalid URLs so a developer can review a separate media-transfer plan.
Installation and usage
- Install Python 3 and extract the ZIP. No packages, account or site credentials are needed.
- Open a terminal in the extracted folder. Run
python3 inventory.py example.xml. The sample returns three attachments with one duplicate and one missing URL. - Export content from WordPress Tools → Export. Keep this XML private: it can contain user information and comments.
- Run
python3 inventory.py "/path/to/export.xml". Optionally save the report with> media-report.jsonusing a new filename. Never redirect output onto the input XML. - Review attachment URLs, arrange an appropriate media backup or migration, and verify files and imported content on staging.
Requirements and tested behavior
Tested with CPython 3.12.14 on Linux using synthetic WXR 1.2 fixtures: eight unit tests and extracted-ZIP command flows. No live WordPress import, Windows execution or real-site export was tested. UTF-8 WXR 1.2 inputs only, maximum 20 MiB; DTD and entity declarations are rejected. The program prints JSON to the terminal and reads only the chosen file.
Limits and troubleshooting
This is an inventory, not a downloader, migration system or complete backup audit. It does not request URLs, verify HTTP status, check file existence, extract inline images, or find media omitted from the export. Duplicate comparison uses exact URL strings. An empty list is not proof that the site has no media. Exit 0 means no URL findings, 1 means review findings, and 2 means invalid input or file error. For unsupported input, obtain a UTF-8 WXR 1.2 export or use a suitable migration tool; do not simply rename another file type.
Privacy, removal and rollback
No networking or telemetry. Reports can contain private URLs; store them securely. The source file and website are untouched. Delete the extracted folder and reports to remove the tool. No website rollback is necessary.
Sources and alternatives
Research date: 6 November 2026. WP-CLI export documents that attachment files and site settings are excluded. WordPress export_wp reference describes the export format. Tools → Export and WP-CLI produce the XML; migration and backup tools handle broader transfer needs. This toolkit adds an offline attachment inventory without requiring access to either server.
License and changelog
MIT. Version 1.0.0: initial release. Run included tests with python3 -m unittest -v.