Solved

Script to create directories from a list

Posted on 2014-11-03
2
157 Views
Last Modified: 2014-11-03
I have a file called "directories.txt" with the names of of new directories I wish to create. Let's say the contents of this file are as follows:

directoryA
directoryB

I need a Win or PowerShell script which, for each line in this file, creates a new directory with the corresponding name and, inside each one, two directories called "subdir1" and "subdir2". So, in the above example, the script will create a directory called "directoryA" and one called "directoryB", each one with directories  "subdir1" and "subdir2" inside.
0
Comment
Question by:Rothbard
2 Comments
 
LVL 9

Accepted Solution

by:
dlb6597 earned 500 total points
ID: 40420007
for /f %%i in (directories.txt) do (
	md %%i
	md %%i\subdir1
	md %%i\subdir2
)

Open in new window

0
 

Author Comment

by:Rothbard
ID: 40420045
Thanks!!!
0

Featured Post

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Possible fixes for Windows 7 and Windows Server 2008 updating problem. Solutions mentioned are from Microsoft themselves. I started a case with them from our Microsoft Silver Partner option to open a case and get direct support from Microsoft. If s…
The following article is intended as a guide to using PowerShell as a more versatile and reliable form of application detection in SCCM.
This Micro Tutorial will give you a introduction in two parts how to utilize Windows Live Movie Maker to its maximum editing capability. This will be demonstrated using Windows Live Movie Maker on Windows 7 operating system.
The viewer will learn how to successfully create a multiboot device using the SARDU utility on Windows 7. Start the SARDU utility: Change the image directory to wherever you store your ISOs, this will prevent you from having 2 copies of an ISO wit…

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question