• 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: How to delete extraneous plist files via AppleScript
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to delete extraneous plist files via AppleScript


  • Subject: Re: How to delete extraneous plist files via AppleScript
  • From: KOENIG Yvan <email@hidden>
  • Date: Thu, 13 Jan 2011 09:18:04 +0100


Le 12 janv. 2011 à 22:12, Barry Fass-Holmes a écrit :

Hello,

The script below compiles and executes without returning any errors, but does not produce the desired outcome during testing.

The desired outcome is to move extra plist files for the weather widget to the Trash. Such files contain an extra extension consisting of a variable combination of characters and numbers. An example is

widget-com.apple.widget.weather.plist.r2wmTrw

This symptom is discussed at http://discussions.apple.com/thread.jspa?messageID=11616688&#11616688

What have I done improperly in this AppleScript?

-- Get current user's name
tell application "System Events"
set currentUser to (name of current user)
end tell

-- Check downloads folder and move extra weather widget plist files to the trash

tell application "Finder"
try
delete (every file of folder "Preferences" of folder "Library" of currentUser of folder "Users" whose name contains "widget.weather" and name extension is not "plist")
end try
end tell

Hello Barry try to insert the word folder between of and currentUser.

The variable contain a string not a reference to a folder.

As I am lazy, I would use a shorter script :

set the_container to path to preferences folder from user domain
tell application "Finder" to tell folder the_container
delete (every file whose name contains "widget.weather" and name extension is not "plist")
end tell

or

set the_container to "" & (path to preferences folder from user domain)
tell application "System Events" to tell folder the_container
delete (every file whose name contains "widget.weather" and name extension is not "plist")
end tell

which will delete the file but will not move them to the trash.

Yvan KOENIG (VALLAURIS, France) jeudi 13 janvier 2011 09:17:39


 _______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users

This email sent to email@hidden

References: 
 >How to delete extraneous plist files via AppleScript (From: Barry Fass-Holmes <email@hidden>)

  • Prev by Date: Re: Variable names
  • Next by Date: Re: Variable names
  • Previous by thread: Re: How to delete extraneous plist files via AppleScript
  • Next by thread: Applescript Users List Search FIXED
  • Index(es):
    • Date
    • Thread