Solved

Script to create directories from a list

Posted on 2014-11-03
2
155 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

Problems using Powershell and Active Directory?

Managing Active Directory does not always have to be complicated.  If you are spending more time trying instead of doing, then it's time to look at something else. For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why

Question has a verified solution.

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

Suggested Solutions

When you start your Windows 10 PC and got an "Operating system not found" error or just saw  "Auto repair for startup" or a blinking cursor with black screen. A loop for Auto repair will start but fix nothing.  You will be panic as there are no back…
A brief introduction to what I consider to be the best editor for PowerShell.
In this video, we discuss why the need for additional vertical screen space has become more important in recent years, namely, due to the transition in the marketplace of 4x3 computer screens to 16x9 and 16x10 screens (so-called widescreen format). …
This Micro Tutorial will teach you how to change your appearance and customize your Windows 7 interface to your unique preference. This will be demonstrated using Windows 7 operating system.

813 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now