I have multi-store website in magento, i want script when we pass alias or parameter then make folder in magento root?

I describe here in full view:-
step 1: alias or parameter is "abc"
now it display in magento website like "abc.site.com" // it is done by me no issue here i allready done in mywebsite

Step 2: Now tha main content here  I face problem here right now:-
I want script which is available in root of magento when alias or parameter pass then make folder "abc" in root of magento and two files index.php & .htaccess inside the "abc" folder.

so please if any body have the any idea on step 2 please  share the code with me.