• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 167
  • Last Modified:

Script to create directories from a list

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:


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.
1 Solution
for /f %%i in (directories.txt) do (
	md %%i
	md %%i\subdir1
	md %%i\subdir2

Open in new window

RothbardAuthor Commented:
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

WEBINAR: GDPR Implemented - Tips & Lessons Learned

Join the WatchGuard team on Thursday, March 29th as we recount some valuable lessons learned in weighing the needs of a business against the new regulatory environment, look ahead at the two months left before implementation, and help you understand the steps you can take today!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now