Gotgatan, Stockholm

Migrating images url from one web platform to another web platform

I recently run into an issue with migrating image URLs from a .NET web platform to WordPress. The issue was that all the images were stored in one folder on the .NET platform content server, and the requirement for the migration of the images was only to move one category to WordPress.

The way the .NET web platform referenced the images used on webpages was by GUID, which was stored in the database together with the URL pathname.

To give an example on the following URL –

When URL is requested, the .NET web platform strips out the “cycling/victories/photos/IMG_20150626_123403.jpg” – search the database for the match – when the match is found the .NET platform uses the GUID to find the image file on the content server.

What I did was to export from the database all the URL paths, add the domain name in front and I got a list of URLs with images to move to WordPress. To actually move the files, I had to use the server command line to copy the files from the .NET web platform by requesting the file by URL using the command curl, here is what I did and it worked out great for me.

Login to your server, navigate to the folder of your WordPress installation where you want the images copied to and use the following commands to do the copying.

cat <<URLS | xargs -P5 -n1 curl -O

This will copy the images from the .NET web platform to your WordPress folder, xargs -P5 let you have 5 concurrent downloads running at the same time.

You could also dump your URLs into a text file and use the wget command

wget -i urls.txt

The last step is to make the files available in the media manager in WordPress – you can read how to do add to a server in WordPress.

For me this worked great for what I need to do, a simple copy of the files, I tested this with over 100 URLs and it worked fine. I hope this is useful information for others, like to comment just look down and provide your feedback.



, ,



Leave a Reply

Your email address will not be published. Required fields are marked *