Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the 'Count all files and subfolder files within a folder' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Count all files and subfolder files within a folder
Authored by: robJ on Nov 10, '04 09:59:05AM
This basic script appears to work on my 10.3.5 system. It should present the same counts that Finder reports when all disclosure triangles are open in a window. It does not count invisible files or items within packages. I don't recommend using this on an entire hard drive although it did not choke/time out on either of mine (internal: 73709 files, 11719 folders; external: 54134 files, 9327 folders).
 set root_fol to (choose folder)

 tell application "Finder"
  set files_ to count files of entire contents of root_fol
  set folders_ to count folders of entire contents of root_fol
 end tell

 display dialog ("Path: " & POSIX path of root_fol) & return & return & ¬
  "Files: " & files_ & return & "Sub-folders: " & folders_ & return & ¬
  "Total Item Count: " & (files_ + folders_) buttons ¬
  {"OK"} default button 1
-- Rob

[ Reply to This | # ]