Count Files in Folder

I have no experience with AppleScript, I am a Flash guy. I am looking for a simple code that will count the number of JPGs in a certain folder then edit a plain text file with the value it comes up with. If anyone can give me help with this or put me in the right direction that would be great.

Thanks


tell application "Finder"
	set theList to files of folder "Your Folder" whose file type is "JPEG"
	set theAmount to number of items in theList as Unicode text
end tell

to test this out make a folder on your desktop with the name “Your Folder” and put some jpegs in it. of course you would change “Your Folder” to the path to the actual folder you want to use. hope that helps.

Now, in OS X, you can’t ensure all jpg files will have a “JPEG” file type. I would check better for: whose name extension is in {“jpg”, “jpeg”}

good point.