Solved

Script to create directories from a list

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

NAS Cloud Backup Strategies

This article explains backup scenarios when using network storage. We review the so-called “3-2-1 strategy” and summarize the methods you can use to send NAS data to the cloud

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Can't log in to windows 7 11 46
Powershell script 13 77
access denied when running native SQL tool: SQLIOSIM 2 26
Simple Q for someone 3 19
New Windows 7 Installations take days for Windows-Updates to show up and install. This can easily be fixed. I have finally decided to write an article because this seems to get asked several times a day lately. This Article and the Links apply to…
While working, an annoying popup showing below will come and we cannot cancel or close it form the screen. The error message will come again and again.
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…
The viewer will learn how to successfully download and install the SARDU utility on Windows 7, without downloading adware.

864 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

21 Experts available now in Live!

Get 1:1 Help Now