What makes it different is that besides the preference plist in $HOME, I want to also move to trash a preference file in /Library/Preferences/.
In one attempt of mine, I did
try
do shell script "mv ~/Library/Preferences/com.filename.plist ~/.Trash/"
end try
try
do shell script "mv /Library/Preferences/com.filename.plist ~/.Trash/"
end try
because I’m more comfortable with shell script than I am with AppleScript, but I’m new at that, too.
The result should be:
Check if file exists in /Library/Preferences - if it does, move to trash - if it does not, move on to next file.
Check if file exists in $HOME/Library/Preferences - if it does, move to trash.
You can also do it in AppleScript and let the Finder delete the files
set prefA to (path to preferences as Unicode text) & "com.elgato.eyetv.plist"
set prefB to (path to library folder as Unicode text) & "preferences:com.elgato.eyetv.plist"
tell application "Finder"
try
delete file prefA
end try
try
delete file prefB
end try
end tell
empty trash -- optional
What adds another wrinkle to this is, I have two files to Trash that are named the same, but in different folders.
In shell commands, it will simply overwrite one with the other. I ended up changing my shell command to name it ~/.Trash/com.filename.plistmain so that I can tell one came from /Library and the other came from ~/Library/Preferences -