I am working on an Apple script that does a purge of a network folder from a Filemaker database. The script worked great in OS 9, took some time to run, but worked.
I switched the machine running the scripts over to 10.4 and it is super slow now. The purge used to take about 10 to 15 minutes, now it times out after an hour.
Here is the part of the scipt that seems slow, the rest of the script is just mounting servers.
tell application "FileMaker Pro"
activate
set filecount to count of records in database 1
try
repeat with i from 1 to filecount
set myfile to the first cell of record i
go to record i
tell application "Finder"
try
if length of myfile > 4 then
delete (every file in folder "Folder 1" of folder "Files" of disk "Server5" whose name contains myfile)
delete (every file in folder "Folder 2" of folder "Files" of disk "Server5" whose name contains myfile)
end if
end try
end tell
end repeat
end try
try
display dialog "All Done"
end try
tell database 1
close
end tell
end tell
I don’t have FMPro, but your delete statements with the filter “whose name contains myFile” require that your script pass the the details from Folder 1 of folder Files of disk Server5 back and forth because because the filter is on your machine and the files are on another. I think you would be better off to download the folder once to your machine, do what you want to do with its contents and then load it back with replacing.
The folder is a couple GBs in size. I am not sure that I want to copy that locally. Would it be better if I had exact file names? The only diffrence between the string I am searching for and the actual file name is 2 letters in the front, either AA or AB.
Downloading a GB is not on. You might be much better off however to get the names of every file in Folder 1, filter them locally into a list of names to be deleted that meet your criteria, and then:
repeat with aFile in deleList
delete file "Server5:Files:Folder1:" & aFile
end repeat
-- same for other folder
Also, why is the tell app “Finder” block inside the tell app “FMPro” block?