• 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: JavaScript for Automation curiosity (was "Script that "Tells" Finder just Focuses on Finder instead of running")
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: JavaScript for Automation curiosity (was "Script that "Tells" Finder just Focuses on Finder instead of running")


  • Subject: Re: JavaScript for Automation curiosity (was "Script that "Tells" Finder just Focuses on Finder instead of running")
  • From: Shane Stanley <email@hidden>
  • Date: Mon, 05 Jan 2015 22:42:02 +1100

On 5 Jan 2015, at 10:12 pm, 2551 <email@hidden> wrote:

This works fine for small to medium sized folders. It works on my Downloads folder, which is a couple of levels deep, returning in a few seconds. However,  it totally chokes on my home folder (the script is still running after 2 minutes, which I consider a fail. I never let it run longer than that to see if it would ever complete).

For comparison, I ran the equivalent in ASObjC:

use framework "Foundation"
set theNSFileManager to current application's NSFileManager's defaultManager()
theNSFileManager's subpathsAtPath:"/Users/shane"

And it took about 70 seconds to return 1032312 files. 

I then did it in Objective-C:

    NSDate *date = [NSDate date];
    NSFileManager *fileManager = [NSFileManager defaultManager];
    [fileManager subpathsAtPath:@"/Users/shane/"];
    NSLog(@"time %f", [date timeIntervalSinceNow]);

And it took much the same (a fraction longer, but I'll put that down to margin of error).

So if you have more files than me, which may well be the case because I don't have a lot of room on my SSD, it could easily take more than two minutes.

And it still doesn't solve the problem of packages, it includes invisible files, and is in a not particularly helpful format...

-- 
Shane Stanley <email@hidden>
<www.macosxautomation.com/applescript/apps/>

 _______________________________________________
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: 
 >Script that "Tells" Finder just Focuses on Finder instead of running (From: Alex Hall <email@hidden>)
 >Re: Script that "Tells" Finder just Focuses on Finder instead of running (From: Deivy Petrescu <email@hidden>)
 >Re: Script that "Tells" Finder just Focuses on Finder instead of running (From: 2551 <email@hidden>)
 >Re: Script that "Tells" Finder just Focuses on Finder instead of running (From: Alex Hall <email@hidden>)
 >Re: Script that "Tells" Finder just Focuses on Finder instead of running (From: Deivy Petrescu <email@hidden>)
 >Re: Script that "Tells" Finder just Focuses on Finder instead of running (From: Shane Stanley <email@hidden>)
 >Re: Script that "Tells" Finder just Focuses on Finder instead of running (From: Deivy Petrescu <email@hidden>)
 >Re: Script that "Tells" Finder just Focuses on Finder instead of running (From: 2551 <email@hidden>)
 >JavaScript for Automation curiosity (was "Script that "Tells" Finder just Focuses on Finder instead of running") (From: 2551 <email@hidden>)

  • Prev by Date: Re: Need helps with my script
  • Next by Date: Re: Permitting a script to only run on OS X Yosemite
  • Previous by thread: JavaScript for Automation curiosity (was "Script that "Tells" Finder just Focuses on Finder instead of running")
  • Next by thread: Re: Script that "Tells" Finder just Focuses on Finder instead of running
  • Index(es):
    • Date
    • Thread