• 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: Kai <email@hidden>
  • Date: Wed, 11 Jun 2003 00:50:08 +0100

on Tue, 10 Jun 2003 09:57:16 -0700, Charles Heizer <email@hidden> wrote:

> 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.
>
> 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

Try something like this:

--=================================================================

set p to "Macintosh HD:Desktop Folder:Logs:" -- amend as required
tell application "Finder" to repeat with f in (folder p's files whose
name ends with ".log")
set o to open for access f with write permission
set eof o to 0
close access o
end repeat

--=================================================================

-------------------------------------------------------
(Any wrapped lines abutting the left edge of the window
should be reconnected to the end of the previous line)
-------------------------------------------------------

--
Kai
_______________________________________________
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.

  • Prev by Date: Re: Loop to erase the contents of my logs ...
  • Next by Date: [OT] [sort of] Entourage Sig Switcher?
  • Previous by thread: Re: Loop to erase the contents of my logs ...
  • Next by thread: list coersion...
  • Index(es):
    • Date
    • Thread