Count folders in applescript?

Hey,

I’m trying to add a folder count to my script, and cant find the right syntax.

I know how to count the entire contents of a folder

I actually use


tell application "Finder"
	set numberOfFiles to count of (files in folder source_folder)
end tell

but how do you count folders ONLY ?

Thanks in advance

Try changing one word in your script.

Oops, sorry …

that wasn’t the problem (of course Ihad tried that) – it’s the condition I used that was just stupid and led to the error :stuck_out_tongue:

Thanks Bruce :wink:

I tried this one and it works fine.
You wrote files in folder source_folder but it should be folders in folder source_folder

set source_folder to alias ("/Users/ronny/Desktop/" as POSIX file)
tell application "Finder"
	set numberOfFiles to count of (folders in folder source_folder)
end tell