• 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
Is my logic wrong here?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Is my logic wrong here?


  • Subject: Is my logic wrong here?
  • From: Jeff Whitmill <email@hidden>
  • Date: Tue, 4 Feb 2003 07:44:29 -0600

I'm trying to write a script to compress web server log files with GZipper.

The files I need to compress have 2 characteristics in their names: They all end in ".log.txt" and they all contain the string "_200".

Thanks to some generous help on this list, this is being accomplished:

try
with timeout of 20 seconds
tell application "Finder"
activate
set theFolder to "MyDisk:Applications:Server:Webserver:MySite:My_Admin:Logs:CurrentLogs:"
select (every file of folder theFolder whose name ends with ".log.txt" and name contains "_200")
open selection using application file "MyDisk:Applications:GZipper"
end tell
end timeout
end try

However, in testing various scenarios, i came upon one that really fouls things up:

If there are no files meeting the criteria, the script compresses the remaining selection - which is the script itself (selected from my having double-clicked on it). I've lost a couple of copies of the script this way.

I don't know if this will be a problem when the script is called by a scheduler (say, Cron, or something like it) - but I'd hate to think there might be something inadvertently selected when this runs.

How do I limit the actions to the files in the folder I'm examining? Am I going about this the wrong way?

Thanks,
--

Jeff Whitmill
Composer Online - http://www.composeronline.com/
The Music of Your Name - http://www.moyn.org/
1510 Thomas Lake Pointe, #304
Eagan MN 55122
Phone: 651.675.0743
Fax: 360-838-8759

"Come, then - weigh me a pound of fire, measure me a bushel of wind, or call back a day that has passed." - 2 Esdras 4:5
_______________________________________________
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.
  • Follow-Ups:
    • Re: Is my logic wrong here?
      • From: Rick cougar Bargerhuff <email@hidden>
  • Prev by Date: Re: Where I can find the AppleScriptLanguageGuide.pdf for Mac OS X?
  • Next by Date: Re: Where I can find the AppleScriptLanguageGuide.pdf for Mac OS X?
  • Previous by thread: Re: Where I can find the AppleScriptLanguageGuide.pdf for Mac OS X?
  • Next by thread: Re: Is my logic wrong here?
  • Index(es):
    • Date
    • Thread