Getting files count of file starting with...

I modified the script I’ve got from a previous post http://macscripter.net/viewtopic.php?id=40123.

Thanks to mouramartins and adayzdone!

I now want to get a count of files in a folder starting with “YTUB” and I would like to get your opinion, Is the attached script in the most efficient way for doing such a count?

Thanks again!
Daniel

set RenameFilesWithinFolder to (path to home folder as text) & "_RenamingFileFolder"

set cntYTUB to ""
tell application "System Events"
	set FilesToBeRenamed to every file of folder RenameFilesWithinFolder whose name extension is "mp4"
	repeat with aFile in FilesToBeRenamed
		set YTUBfiles to text 1 thru 4 of (get aFile's name)
		if YTUBfiles is equal to "YTUB" then set cntYTUB to cntYTUB + 1
	end repeat
end tell
display dialog "cntYTUB: " & cntYTUB

Try:

set RenameFilesWithinFolder to (path to home folder as text) & "_RenamingFileFolder"
tell application "System Events" to set FileCount to count of (get every file of folder RenameFilesWithinFolder whose name begins with "YTUB")

Thanks adayzdone!

It is much simpler and does what I needed.

Daniel