• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: recursive folder count
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: recursive folder count


  • Subject: Re: recursive folder count
  • From: Skeeve <email@hidden>
  • Date: Fri, 29 Feb 2008 09:04:09 +0100

Peter Baxter wrote:
> The result is different!
I would expect that because the notion what to count and what not is different for both, find and AppleScript.


Here are some more examples.

set sourceFolder to choose folder
tell application "Finder"
set started to current date
set as_count to (count (get entire contents of sourceFolder))
set lap_time_1 to current date
set find_all to (do shell script "find " & (quoted form of POSIX path of sourceFolder) & " | wc -l") as integer
set lap_time_2 to current date
set find_files to (do shell script "find " & (quoted form of POSIX path of sourceFolder) & " -type f | wc -l") as integer
set lap_time_3 to current date
set find_directories to (do shell script "find " & (quoted form of POSIX path of sourceFolder) & " -type d | wc -l") as integer
set lap_time_4 to current date
set find_non_hidden to (do shell script "find " & (quoted form of POSIX path of sourceFolder) & " ! -name .\\* | wc -l") as integer
set stopped to current date
return {|as|:{as_count, lap_time_1 - started}, |find all|:{find_all, lap_time_2 - lap_time_1}, |find files|:{find_files, lap_time_3 - lap_time_2}, |find directories|:{find_directories, lap_time_4 - lap_time_3}, |find non hidden|:{find_non_hidden, stopped - lap_time_4}}
end tell


Gives in my test:
{
   |as|:               {6071, 43},
   |find all|:         {8585,  3},
   |find files|:       {7640,  3},
   |find directories|: { 944,  0},
   |find non hidden|:  {8421,  0}
}

I can't explain exactly why these huge differences are there, but I'm not at all astonished that they are there.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users


This email sent to email@hidden
References: 
 >recursive folder count (From: Tim Piper <email@hidden>)
 >Re: recursive folder count (From: Skeeve <email@hidden>)
 >Re: recursive folder count (From: "Mark J. Reed" <email@hidden>)
 >Re: recursive folder count (From: Peter Baxter <email@hidden>)

  • Prev by Date: Re: linebreak in a shell script; was Re: What's wrong with this call to zip?
  • Next by Date: Re: mail.app, bottom post, applescript
  • Previous by thread: Re: recursive folder count
  • Next by thread: Re: recursive folder count
  • Index(es):
    • Date
    • Thread