seyo IV
seyo IV

Reputation: 177

Powershell create many folders from a path

I have a Path C:\dir1\dir2\dir3\dir4.

I want to split the path and create each of the folder like in the shown structure.

Has anyone any ideas how to do this?

Upvotes: 0

Views: 203

Answers (1)

henrycarteruk
henrycarteruk

Reputation: 13217

No need to split the path, you can create all the folders and sub-folders in one command:

New-Item -ItemType Directory -Path C:\dir1\dir2\dir3\dir4 -Force

Upvotes: 3

Related Questions