About This
I am Michael Tyson, and I run A Tasty Pixel. I write on a variety of technology and software development topics as I travel around Europe in a motorhome.
-
Subscribe to updates 203 feed subscribers
Follow me on Twitter 367 followers
Newsletter
Let us keep you informed about important updates, special offers, and new products. Just type in your email address below and hit enter to sign up!
My Products
Popular Posts
- "Elegant Grunge" Wordpress theme
- Using RemoteIO audio unit
- Custom Permalinks
- Connecting an iMac up to your TV
- Smart 404 for Wordpress
- UIImage, resolution independence and the iPhone 4's Retina display
- Flickrpress: Wordpress Flickr widget
- Easy rounded corners on UITableViewCell image view
- Making UIToolbar and UINavigationBar's background totally transparent
- Sort your Flickr photostream
Re-organising/assembling uploads for WordPress
Migrating from Serendipity, I’ve had a few hiccups in data migration. It doesn’t help that I’m extremely OCD when it comes to data, so everything’s gotta be perfect.
I had a problem with the way my uploads (the resources linked into the blog) were organised from the old Serendipity days – all in one big ol’ folder – and wanted to re-arrange them the way WordPress does it, which is to arrange them into folders by year and month.
This is also useful if you’re changing your domain, or splitting up one blog into two. The entries link to the old domain/blog, and thus the alternative is to do keep the old site around or muck around with clever redirects.
My way’s neater.
So, I put together a script which goes through all posts, pulls out links to uploaded files, and moves/copies them into a better arrangement, fixing the link in the process. If it can’t find the files, it’ll use a ‘find’ command to attempt to locate them.
In case it’s useful to others, the script is here: reorganise-wp-media.php.zip
It goes in the WordPress webroot; put it there, then edit it to apply your settings. Give it a ‘dry run’ test, make sure all is well, then go for it. Beware, although I used it and it worked okay, I offer no guarantee that it won’t mangle your data, delete random files or eat your dog.
Related posts