Snippet of student_folder.csv data (anonymised) |
#File location of .csv
$csvPath = "C:\User Files\student_folder.csv"
#Import .csv into script
$csv = Import-CSV $csvPath
#Work through each row in turn
$csv | ForEach-Object {
#Create a variable based on attributes from the column headings for the name
$name = $_.LastName + " " + $_.FirstName + " " + $_.College + " " + $_.ID
#Create main 'Student Folders' folder and then sub-folders with above name attributes
$folderpath = "C:\User Files\Student Folders\" + $name
New-Item $folderpath -ItemType Directory
}
⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯
Bulk folder creation from spreadsheet.ps1
Sample student_folder.csv
No comments:
Post a Comment