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