>--------------------------------------------------------_593078999_-
>Subject: Slow SIMS, deleting Logs
>Date: Tue, 16 Jul 2002 20:20:20 -0700
>From: Thomas Tempelmann <[EMAIL PROTECTED]>
>Content-Type: text/plain; charset="US-ASCII"
>Message-Id: <[EMAIL PROTECTED]>
>
>After a few months, SIMS always gets awfully slow, making the
>entire machine slow. I found that it's because there's too many
>log files in one folder, which apparently slows down access to
>the folder.
>
>I wonder if there is an easy way to keep the logs to a few
>dozen at any time? E.g, has someone made an AppleScript that
>periodically scans the folder and removes old ones? If so,
>could you direct me to it, or just send it to me?
>
>Thomas

Thomas,

Here is a script I have been using for a couple years. You should be 
able to just paste it into a script editor window and save as an 
application, never show startup screen and stay open should be 
checked.  The script should run every 86400 seconds but there seems 
to be a bug in some versions of AS that make it run every 30 seconds. 
The script is commented to tell you what it all does.

Let me know if it works for you.  It may need an OSAX, but I don't 
think so.  If it does I can try to figure out which one and send it 
to you privately.



-- Wrap the whole thing in an on idle handler so it gets run periodically
on idle
        --Bring the script to the front so it runs faster
        activate
        --Define the variables
        set simslogs to (path to system folder as string) & "SIMS folder:Logs"
        --Change the following value to control number of logs saved
        set numtosave to 10
        --How often the script should run
        set interval to 86400
        set filelist to list folder simslogs
        set numlogfiles to count of filelist
        --Check to see if we have any old files to delete and then delete them
        if numlogfiles > numtosave then
                set i to numlogfiles
                repeat with name in filelist
                        if i > numtosave then
                                set filename to simslogs & ":" & name
                                deleteFile filename
                        end if
                        set i to i - 1
                end repeat
        end if
        --Bring the Finder to the front. You might want to change the value
        --of this statement to pop another program to the front
        tell application "Finder" to activate
end idle



Good Luck,
-- 
Paul Didzerekis
Owner, Three Rivers Internet
http://www.3-rivers.com or http://www.threeriversinternet.com
Professional website hosting, authoring, & consulting.
        E-commerce using our exclusive EasyCartSystem
LOCAL PHONE 946-3163         ******       TOLL FREE 800-426-6646

#############################################################
This message is sent to you because you are subscribed to
  the mailing list <[EMAIL PROTECTED]>.
To unsubscribe, E-mail to: <[EMAIL PROTECTED]>
To switch to the DIGEST mode, E-mail to <[EMAIL PROTECTED]>
To switch to the INDEX mode, E-mail to <[EMAIL PROTECTED]>
Send administrative queries to  <[EMAIL PROTECTED]>

Reply via email to