Re: Finder Scripting Speed
Re: Finder Scripting Speed
- Subject: Re: Finder Scripting Speed
- From: deivy petrescu <email@hidden>
- Date: Mon, 1 May 2006 22:57:38 -0400
On May 1, 2006, at 22:35, Richard Patterson wrote:
I have written an AppleScript to recursively look for files in a
few nested folders and let me know how many files there are. When
I run it on a folder that contains I think 19 folders some of which
have 600 files, it takes about 30 seconds to execute. In the
handler that recursively looks for files in folders it assumes that
any folder which has a file in it rather than another folder is as
far down as it needs to go and it just reports the number of items
in that folder and adds it to a comma separated list which it puts
on the clipboard for Filemaker to paste into a field and use.
It seems that 30 seconds is an extremely long time for something
like this and I am wondering if the finder is just slow in
executing scripts or if there is some way I can really improve the
speed of this.
=======================================
<snip script>
Richard Patterson
Richard:
You might try this, since it is probably faster, although, it might
take a while depending on the level of nested folders:
<script>
set the scans_folder to (choose folder with prompt "Pick the folder
containing the scans you want to log:")
set folder_record to {}
tell application "Finder"
set allFolders to every folder of entire contents of folder
scans_folder
repeat with someFolder in allFolders
set someFolder to contents of someFolder
set ctfls to count of files in someFolder
set end of folder_record to {folder_name:someFolder as string,
file_count:ctfls}
end repeat
end tell
folder_record
</script>
Deivy
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden