Support » Plugin: Custom Upload Dir » [Plugin: Custom Upload Dir] Mapping to custom directory upon export / import

  • Resolved jdorough


    I am moving my website to a different web host, and that requires me to export all my content (4000+ posts, 9000+ comments, etc) and then import them into the new site. I’ve been using Custom Upload Dir on the old site and love it. Is there a good way for me to get all my data from the old site over to the new one while maintaining the directory structure CUD used for my images and while keeping the images attached to the correct posts (so as not to break galleries, etc)?

    I tried doing a straight export and then import with the download attachments option checked, but I ran into a couple of problems:

    1) Not all the posts transferred over. I suspect this has to do with the host server timing out on the export.

    2) All the imported images got dumped into the uploads folder, instead of going into their original directory structure (which should be %year%/%month%/%day/%).

    If anyone could give me some help with figuring this out, I’d appreciate it greatly.


Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author ulfben


    I’ve actually never been able to import pictures using WordPress “native” import – downloading attachments have never ever worked on any of the servers I’ve maintained.

    Thus; I really have no idea if the import respects the upload_dir-filter.

    What I do when moving sites is;
    1. dump the database (sql)
    2. search-&-replace the domain name in the database dump
    3. copy filesystem to new server
    4. import database

    Serialized arrays can get destroyed when search-&-replacing (strings change length). This has never caused any problems for me though.

    You should set up a local XAMPP on your machine to test the procedure first (just replace domain with “http://localhost/”). It takes you 15-20 minutes to try it out that way.



    Thanks so much for the reply. Once I get the site moved and the domain name changed over to point to the new host, all the addresses on the new site will be the same as with the old site. Am I correct that I wouldn’t need to do step 2, then (since the domain name will be the same after the move)?

    I’ve never done SQL dumping and importing before, so could you please let me know if these are the correct steps? I will be using phpMyAdmin to work with both databases. I will:

    1) Follow the instructions here to do a full export of my original database: and save that file to my local system.

    2) Download the full original site’s files to my local system using FTP.

    3) Upload all those files to the new host using FTP.

    4) Follow these instructions to import the saved database file into the new host database:

    Is that the correct sequence? And am I right in thinking that this method will maintain my directory structure, as well as the attachment links between media and posts, etc? Essentially I’ll end up with an exact copy of the original site onto the new server?

    Thanks again for the help, and I’m sorry if these are very elementary questions. It’s the first time I’ve done this sort of thing 🙂

    Plugin Author ulfben


    Yes, exactly like that.

    But again; I strongly recommend you run a local XAMPP-installation and test the import on that first.

    Server moves can be harrowing for sure, but you seem to be well researched. Good luck!

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘[Plugin: Custom Upload Dir] Mapping to custom directory upon export / import’ is closed to new replies.