Batch Zip Folders And Name With Foldername+size

i all
From a HD structured this fashion (example)
and so on
and so on

I hope to be able to select the CLASS folder and batch zip all the STUDENTNAME folders inside it naming the zipped file: StudentnameA+Foldersize
the foldersize should refer only to the visible items inside it, skipping the .DS_Store, .localized and all possible invisible items it may contain

I know there is an Automator function doing it. But I’d rather use Applescript for many reasons.

Thanks a lot

Browser: Safari 537.73.11
Operating System: Mac OS X (10.8)

I did this attempt thanks to the help of a friend

tell application "Finder"
	set myFolders to every folder of (choose folder)
	set destinationPath to POSIX path of (container of (item 1 of myFolders) as string)
end tell
repeat with aFolder in myFolders
	tell application "Finder" to set filesize to size of files in the entire contents of aFolder as string
	set basename to do shell script "basename " & POSIX path of (aFolder as string)
	do shell script "ditto -c -k --sequesterRsrc --keepParent " & quoted form of POSIX path of (aFolder as string) & space & quoted form of (destinationPath & "-" & basename & filesize & ".zip")
end repeat

However I receive this error all the time. Could someone help please

tell application “Finder”
choose folder
→ alias “Hwork:ClassA:”
get every folder of alias “Hwork:ClassA:”
→ {}
error “Can’t make «class ctnr» of item 1 of {} into type string.” number -1700 from «class ctnr» of item 1 of {} to string

Also would it be possible to choose a destination folder for the Zipped Files?


the error occurs if the folder list is empty, therefore there is no item 1