• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Loop to erase the contents of my logs ...
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Loop to erase the contents of my logs ...


  • Subject: Re: Loop to erase the contents of my logs ...
  • From: Charles Heizer <email@hidden>
  • Date: Tue, 10 Jun 2003 11:46:13 -0700

Hi,
Thanks, that's why I do a set logLoc to (POSIX file logLoc) as Unicode text which converts "/var/log" to ":var:log"

The real real wall is with the loop, I'm trying to erase the contents of the files, not delete them.

- Charles

On Tuesday, June 10, 2003, at 11:05 AM, Andrew Oliver wrote:

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.

References: 
 >Re: Loop to erase the contents of my logs ... (From: Andrew Oliver <email@hidden>)

  • Prev by Date: Re: class PSN
  • Next by Date: Re: class PSN
  • Previous by thread: Re: Loop to erase the contents of my logs ...
  • Next by thread: Re: Loop to erase the contents of my logs ...
  • Index(es):
    • Date
    • Thread