I need to create a folder structure via command line, structure is as follows :
username > folder1 > folder2 > folder3 (and there are subdirectories within these folders as well)
This is a windows host, I have done "dir /ad > dir.txt (It outputs the parent folder)
Also, which command on dos would I use to create folder from text file ?
I have used xcopy /T /E (it fails at a certain point as the files are being read from these folders majority of the time), I have around 1500 folders and then sub-folders within these folders.
You're question is not very clear about what you actually need to do.
As I read it you have list in a text file consisting of all the folders you need to create which was created by doing a dir /ad.
That is you first problem. If you do this in the users home-folder on Vista or Win7 you get a mix of dirs and junctions. You will have decide how to threat those. (Maybe skip the junctions ?)
Then you can use a variant on the FOR command to read the text file and call the MKDIR command for each folder.
Use FOR /? and MKDIR /? for some help. You will need CMD Extensions enabled. See CMD /? on how to do that if neccessary.
Be warned: FOR has very obscure and cryptic syntax, but it can do some amazing things if used properly.
EDIT: After seeing the comments (and having a Windows box handy to check syntax):
dir /ad /b /s will get you a plain folder-list.
You will have to edit the output in a text-editor to change the drive-letter at the from or insert some extra level of folders some-where. You have to place a " before and after each line to handles paths with spaces properly.
Then run it through FOR like this:
Please note: The FOR command requires you to use %%i in stead of %i when you use it in a batch-file (as opposed to interactively).
It's not realy clear what you want. Do you want to replicate a directory structure from one PC to the other and is there a connection between the host on which you created the textfile? If so, you can copy a directory structure without the files in it using the commandline:
robocopy [source] [destiantion] /Create
Or is it that you have a textfile with all the paths in it that you want to create. If so you might want to be creative with notepad. For example if you have a file that has the directories you want to create like:
c:\Users\john\dir1
Open the file with notepad. Press CTRL+H and replace 'C:' with 'MD C:'. Your file should look like this.
MD c:\Users\john\dir1
Now save the file as a batchfile (e.g. createfolder.cmd) and doubleclick it. It will create all the folders. If some directories contain spaces this will fail. You can paste all in excel in colmn B. In colmn A, add MD ", in colmn C add " select all and copy to notepad again. Now replace all Tab's with an empty string and save as a batchfile.
I hope it helps.
PS: If you are familiair withe to 'for' command this would be easier, but 'for' is indeed rather complicated.