Re: How to delete extraneous plist files via AppleScript
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
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