Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I have a heap of images inside MovableType, on an old server. There are plenty which have character entities like %20 to represent spaces.

I've used some plugins to import the images and change the URLs inside posts, but while MT can deal with /my%20dog.jpg, WP just shows a 404.

Assuming there's no way to get WP to display these images, and I have to rename them, what's the best way to:

  • Rename all the files (strip out character entities)
  • Rename all the URLs referenced in posts

I'm a little bit stuck here and not sure what the best way of solving this would be, whether via SSH and SQL queries, or otherwise.

share|improve this question
add comment

1 Answer 1

You are going to need:

1. Total Commander (or anything else that allows you to rename massive numbers of files)

Probably the best file manager in the world (especially when it comes to handle uploads etc.), it's not free but the trial version should do the job. Just select all these images (they could be anywhere within Total Commander and choose "Multi-Rename tool (CTRL+M)" from "File" Menu.

In "Search for" field type: %20 then change it to anything you like within "Replace with" field (I guess the best choice would be: _).

Get Total Commander from: http://www.ghisler.com/

2. A simple SQL command.

UPDATE wp_posts SET post_content = replace(post_content,"%20","_");

It just "scans" every post for %20 and then simply replaces it with _

I hope it helps.

share|improve this answer
    
Thanks - I'll give that a go and see if it helps! Wish this could be done with htaccess/server side, though. –  Jon Lay Nov 6 '11 at 13:16
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.