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... |