School Foldering Automization

Any one have an idea or clue on if there is anything available for taking a list of name, in an excel file or text file and making folders out of each name in that file, that could be automatically sorted out by class, if the original file was prepared properly?

Hi digitlhand,

If you can sort your data like:

Class 1,first student,second student,third student
Class 2,first student,second student,third…

ie a csv file with the first item of each line being the class name, then this should work:

--Find the data file and get the data
set myList to read (choose file with prompt "Where is the csv file?")
--Choose the destination folder
set rootPath to (choose folder with prompt "Where do you want the folders to go?")
--Repeat in lines of the data
repeat with myLine in paragraphs of myList
	--Check for empty lines
	if myLine is not "" then
		--Get individual records
		set {TIDs, AppleScript's text item delimiters} to {AppleScript's text item delimiters, {","}}
		set myItems to text items of myLine
		set AppleScript's text item delimiters to TIDs
		--Set path to chosen folder
		set thisPath to rootPath
		--Flag to set Class folder
		set className to true
		--Repeat in individual records
		repeat with theItem in myItems
			--Make a folder
			tell application "Finder" to make new folder at thisPath with properties {name:theItem}
			--Set for Class folder
			if className is true then
				set thisPath to alias (thisPath & theItem & ":" as string)
				set className to false
			end if
		end repeat
	end if
end repeat

You select the text file and the destination folder.

Best wishes

John M

Thank You so Much