Automatic file and directory structure creator

I don’t think I am the only one who would like to create a file structure such as:

I would like to do this for every country in the world. But the tediousness kills me. Is there a ready-made directory structure such as this available? Or a program or script that would do this for me automatically from lists of countries, states, cities etc.? I used a program called “Folder Maker” which is great at creating single level folders or files but then i have to put each file in the correct folder manually. I could hire someone from Elance to do this for me but . . . any ideas or help would be appreciated.

This is precisely the type of tedious, repetitive task that scripting languages are well-suited to manage.
You could create a script that reads from a text file and creates the structure you defined here (in PHP, Ruby, Perl…)

Is your server on a *nix operating system or on Windows? That has some effect on which scripting tools you have available to you.

I guess there are scripts that would help if you must do it this way.

But if you’re just starting I suggest you look into “routing” i.e. virtual paths, not actual physical paths

Thanks for the help, ParkinT. Unfortunately, I am not a programmer. I can get by with most HTML and some PHP and JavaScript but creating a script myself is not something I would attempt. I was hoping to find a ready-made structure that someone had created, and which I would be willing to pay for. (Maybe I should hire someone to create a script for me? I wonder what that would cost or how long that would take?) I have programs to rename and create files and folders in batches so it would not take much to remodel an existing file structure if it was available. (Hmmm… this makes me think that I only need to do one state in one country and then simply do a batch rename of the folders and files for other countries and states. That should work, I think.)

The problem is the size of the job. For example, one country, fifty states in United States, one state, alabama, has 777 cities and towns which works out to roughly 40,000 files and 60,000 directories for one country and there are 270 countries in the world! I can create the folders using a folder creator and I can create the files using a file creator in just seconds after compiling the lists in a csv file, which takes some time as well. But then I have to drag and drop 777 files into their respective folders. It took me more than two hours for the cities in Alabama. Am I dense? Is there an easier way? Why hasn’t anyone done this before me or why isn’t there a script to do this type of thing? I don’t think this is the first time someone has thought of doing this, but my search has not turned up any leads to software or scripts that would do this exact task. As for creating the virtual folder structure, Mittineague, for reasons I cannot divulge, I need the actual folders and files on the server.

I think the reason your need seems unique is that the simplest approach (which others would take) is to generate the pages dynamically based on the details (city and state) being read from a database.
You indicated that is not possible in your case but I can see no reason why such a solution would not meet your need.
If you have a requirement for others to upload documents to the folders - for example - those uploads would just be stored in the database with a reference to the page on which they live.
The entire folder structure you describe could ‘exist’ as a definition in a database. That is how many large sites work (Amazon, eBay, for example); an entire site (or set of sites) exists in the database and each page is generated and served as requested.

It can be done by someone else, but not by me because I am not a programmer and I don’t know how.