• 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
How can I speed up execution time of this script in case of many files
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

How can I speed up execution time of this script in case of many files


  • Subject: How can I speed up execution time of this script in case of many files
  • From: Bert Groeneveld <email@hidden>
  • Date: Thu, 01 Aug 2013 23:19:39 +0200

Hi, I wrote a script to check if files in an incoming folder are stabilized for further processing. It works fine, but unfortunately very very slow with large amount of files (let's say more then 500 files). How can I speed up execution time with many files? I already tried a trick on large lists that I often use (read it in a book once) by using the word my in the repeat loop to reference the items in a list, but for some reason I get an execution error (see 2 places in the script that I commented).

Maybe the same can be done with some "do shell script"? But I really wouldn't know how to do that.

Thanks in advance for any help. Bert.

on Preflight_Images()
set myFiles to {}
tell application "Finder"
set myFiles to myFiles & every file of the_Preflight_WEBSHOP_subfolder
set myFiles to myFiles & every file of the_Preflight_IMAGEBANK_subfolder
end tell
set number_of_files to (count of myFiles)


set First_File_sizes to {}
-- repeat with aFile in my myFiles: Execution error!!!
repeat with aFile in myFiles
tell application "Finder"
set size_of_a_file to size of aFile
end tell
set the end of First_File_sizes to size_of_a_file -- create list of file sizes
end repeat
delay 5 -- stabilize time
set Stabilized_Files to {}
repeat with counter from 1 to number_of_files
-- set aFile to item counter of my myFiles: Execution error!!!
set aFile to item counter of myFiles
tell application "Finder"
set size_of_a_file to size of aFile
end tell
if size_of_a_file = item counter of First_File_sizes then
set the end of Stabilized_Files to item counter of myFiles
end if
end repeat
-- further processing
end Preflight_Images
 _______________________________________________
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

  • Follow-Ups:
    • Re: How can I speed up execution time of this script in case of many files
      • From: Christopher Stone <email@hidden>
    • Re: How can I speed up execution time of this script in case of many files
      • From: Peter Baxter <email@hidden>
  • Prev by Date: Re: Moving & deleting a mailbox in Mail
  • Next by Date: Re: How can I speed up execution time of this script in case of many files
  • Previous by thread: Re: urlEncode (AppleScript fails in Automator - Permissions error)
  • Next by thread: Re: How can I speed up execution time of this script in case of many files
  • Index(es):
    • Date
    • Thread