Newbie question, please.
Newbie question, please.
- Subject: Newbie question, please.
- From: "Gregory Smith" <email@hidden>
- Date: Fri, 12 Jan 2001 10:36:01 -0800
Hello,
Two, hopefully quick questions...
I just recently started attempting to write a "from ground up" AppleScript.
My prior experience was cut and pasting from previously written scripts.
(Always giving credit of course...)
My project is to write an AppleScript to check and delete in a defined
folder on our network server files that are over 24 hours old. We use this
"temp" folder on each volume of our server to store files that are only
needed for less than 24 hours. (Typically pick ups of previous jobs that are
archived.)
I have successfully written my script to the point where it will read the
files and folders in the defined folder and move the files over 24 hours old
to a new folder within the "temp " folder. This new "to_trash" folder with
24 hour plus files and folder will then be moved to the trash and deleted
leaving the less than 24 hour old items intact. This script runs once every
hour.
My question is... how can I determine if the script is running as fast as
possible? How does a developer test for efficiency? While my script does
work, it also seems to take a fair bit of time to complete the task at hand.
20 seconds or so for a half dozen test files on local machine (G4 400Mhz).
Maybe this time period is to be expected because of the date and
modification comparison routines I have written.
Second, where do I look for help with the trash and delete routines? I've
written (recorded) a routine to move the "to_trash" folder as a module using
test files and folders, but when I incorporate the routine in my main script
nothing happens. No error. No moving to the trash and of course no delete.
Also, I will eventually need to delete without prejudice as some files
report "the file is in use" errors when deleted by manually. This error is
an artifact of our server and our output device, but the files are really
not in use.
The code I am using for this part of the script is as follows:
select folder tempToTrashFolder of folder appleScriptTestFolder
delete selection
empty trash
Thanks for your help in advance.
--
Thanks,
Greg Smith