Re: Loop to erase the contents of my logs ...
Re: Loop to erase the contents of my logs ...
- Subject: Re: Loop to erase the contents of my logs ...
- From: Andrew Oliver <email@hidden>
- Date: Tue, 10 Jun 2003 11:05:53 -0700
The Finder doesn't follow the POSIX-based, /-delimited pathnames. Instead is
uses the Mac OS-based :-delimited pathnames
So:
tell application "Finder"
set logFiles to name of every file of folder ":private:var:log3" whose
name ends with ".log
delete logFiles
end tell
On 6/10/03 9:57 AM, "Charles Heizer" <email@hidden> wrote:
>
Hello,
>
I'm stuck. I'm trying to write a small apple script to clear the
>
contents of all of my logs before I image my system, but I keep hitting
>
a wall. I can do this with a foreach statement using a shell script but
>
I wanted to find out how to do it with applescript.
>
>
Thanks,
>
>
- Charles
>
>
>
Here is my code --
>
>
property attributes : {}
>
property multiple : 1
>
>
set logLoc to "/private/var/log3"
>
set logLoc to (POSIX file logLoc) as Unicode text
>
tell application "Finder"
>
set logLoc to name of every file of folder logLoc whose name ends with
>
".log"
>
end tell
>
>
repeat multiple times
>
repeat with c in logLoc
>
set end of attributes to {c}
>
end repeat
>
end repeat
>
activate
>
repeat with i in attributes
>
set theLog to item 1 of i
>
set theLog to open for access theLog with write permission
>
set eof theLog to 0
>
close access theLog
>
end repeat
>
_______________________________________________
>
applescript-users mailing list | email@hidden
>
Help/Unsubscribe/Archives:
>
http://www.lists.apple.com/mailman/listinfo/applescript-users
>
Do not post admin requests to the list. They will be ignored.
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.