General discussion


Convert Folder Structure

By bellt ·
I have an empty folder structure that is created in excel. Is there a way to move the structure to "My Documents" and create the folders without re-typing them?

This conversation is currently closed to new comments.

Thread display: Collapse - | Expand +

All Comments

Collapse -

Creating folder structure.

by TheSwampster In reply to Convert Folder Structure


depending on the format of your folder structure in XL i.e. do you have full paths or have you just moved over a column to show hierarchy?

the easiest is to have the full path (relative to the my documents folder) eg in cell a1 you would have \folder 1
then a2 \folder 1\folder 11
a3 \folder 1\folder 12


If you had this format then save the file as a text file (foldernames.txt) and then paste the following into a batch file

FOR /F %%i in (foldernames.txt) do (Md "%userprofile%\My documents\%%i)

save the above lines as something like directorycreate.bat in the same directory as your foldernames.txt file and run the batch file.

Hey presto your directory structure is created.

If you have redirected your my documents folder amend the batch file to create the directories in the new location.

MD will also create intervening folders if required so

MD \folder 1
md \folder 1\folder 11

is the same as md \folder 1\folder 11

If you have indented to show the folder hierarchy then its a bit more complicated - a bit of vb script to parse the output - but its probably quicker to just put it in the format suggested above - drag the parent folder names down and then save as csv - put into notepad/text pad and replace the commas with \


Related Discussions

Related Forums