Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

mduser63

macrumors 68040
Original poster
Nov 9, 2004
3,042
31
Salt Lake City, UT
I'm trying to count all the files of a certain type in a folder in an AppleScript I'm writing. Does anybody know how to do this. I can't count all the files in the folder with the following code:

set NoOfFiles to count each file in theFolder

But, I can't figure out how to only count a particular type of file (in this case FLAC files). Ideally I'd like a way to count files that have a particular extension, but counting based on the "kind" attribute in the finder would be ok too.
 
Try this:
Code:
tell application "Finder"
	set NoOfFiles to count of (files in folder theFolder whose name extension is "flac")
end tell
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.