PowerShell: Creating Multiple Folders
So you were scheduled to create many, many, many folders within a network share folder. Well, PowerShell will save you life one day! It did for me :). Here is the coding I used to get this to work for me. I didn’t get to involve with the permission part, but if you guys have something better then this please comment and share your knowledge.
$Users = Get-Content "C:\Users\BJ\Desktop\ADuser.txt"
ForEach ($user in $users)
{
$newPath = Join-Path "\\BJ-Share\User" -childpath $user
New-Item $newPath -type directory
}
note:
- $newPath = Join-Path “\\BJ-Share\User” -childpath $user \\if the User folder does not exist it will be created for you 🙂
- ADuser.txt – can be named anything, also the format within the text file is simple just type in the name of the folder and hit enter for each folder name. example: click here
If this post helped you, PLEASE take the time to +1 it.
Leave a Reply