No AppleScript:
local nitems
tell application "Finder" to set nitems to count of items in folder "mress HD:Users:allbery:Desktop"
set the clipboard to (nitems as Unicode text)
O Finder ainda usa caminhos no estilo Carbon, como mostrado acima. para converter requer algo bobo como
local nitems
local fpath
tell application "System Events" to set fpath to path of disk item "/Users/allbery/Desktop"
tell application "Finder" to set nitems to count of items in folder fpath
set the clipboard to (nitems as Unicode text)