I'm in a massive migration from a home grown CMS. So far I've been successful at using Feed Import to slurp in CSV exports of the old MySQL database. The old database contained page URLs. So I just mapped this over to Page Alias!

Now I'm searching for a more automated way to take this


into a menu structure like this:

Navigation Menu 
+- Program 

Yes, I could do this manually, but I have over two thousand imported pages.

Is there an Alias URL to Menu structure script or module that may help me along?


Based on feedback below, I decided to pull a list of URLs from the CSV file using the following pipe line. That is, I pulled only 5th column (the URLs), sorted the output, filtered urls that had "/programs/", and cut off the trailing quote

awk -F ',"' '{print $5}' programs.csv | sort | grep programs | sed "s/\"//g"

After that was exported to a file, a ran the following to generate the child items of the menu:

cat programs.just.urls.txt | awk -F '/' '{print $3}' | egrep -v "php$" | uniq

1 Answer 1


I'd give the Menu Export/Import module a go.

This module helps to export and/or import menus. Using it you can easily copy menus from one Drupal site to another.

It also allows developers to quickly build a new Drupal site by creating empty content and menu items referencing it. The module may be used in ensemble with Node export that allows to add content to your Drupal site. In this case, menu import allows to batch-arrange existing content into a given menu structure, using a very simple text file.

I guess you could possibly use Excel or something to take your list of aliases and split the paths to columns which would give you the menu title (in the last column of the split).

From there you have the menu link titles and paths, so it's just a case of getting it into the format that the module expects.

  • Interesting, since I already have the data in a CSV (spreadsheet), I could pull that URL column in PHP and create that JSON like structure. That may be worth doing!
    – Rick
    Commented Feb 20, 2013 at 16:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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