Is there a command that will delete a file/folder immediately without send it to the trash. I want to write a script that will delete some preferences and remove them right away with out having to move them to the trash then emptying it.
Thanks again Stefan,
Do you know how I would incorporate that into my script. I’m sort of lost.
tell application "System Events"
set AppleScript's text item delimiters to {","}
set theprocess to name of every process as list
end tell
if theprocess contains "Linotype FontExplorer X" then
tell application "Linotype FontExplorer X" to quit
end if
delay 5
tell application "Finder"
activate
close every window
if folder "Users:Shared:Linotype" of startup disk exists then
delete folder "Users:Shared:Linotype" of startup disk
end if
if folder "Library:Application Support:Linotype" of home exists then
delete folder "Library:Application Support:Linotype" of home
end if
if file "com.linotype.FontExplorerX.plist" of folder "Library:Preferences" of home exists then
delete file "com.linotype.FontExplorerX.plist" of folder "Library:Preferences" of home
end if
end tell
tell application "System Events"
set AppleScript's text item delimiters to {","}
set theprocess to name of every process as list
end tell
if theprocess contains "Linotype FontExplorer X" then
tell application "Linotype FontExplorer X" to quit
end if
delay 5
tell application "Finder"
activate
close every window
if folder "Users:Shared:Linotype" of startup disk exists then
delete folder "Users:Shared:Linotype" of startup disk
end if
if folder "Library:Application Support:Linotype" of home exists then
delete folder "Library:Application Support:Linotype" of home
end if
set FileToDelete to (path to preferences as Unicode text) & "com.linotype.FontExplorerX.plist"
if exists file FileToDelete then
do shell script "rm " & quoted form of POSIX path of FileToDelete
end if
end tell
tell application "System Events"
if "Linotype FontExplorer X" is in (get name of processes) then
quit application "Linotype FontExplorer X"
end if
end tell
delay 5
tell application "Finder" to close every window
delete_item(((path to users folder) as Unicode text) & "Shared:Linotype:")
delete_item(((path to home folder) as Unicode text) & "Library:Application Support:Linotype:")
delete_item(((path to preferences folder) as Unicode text) & "com.linotype.FontExplorerX.plist")
on delete_item(theItem)
try
set I to theItem as alias -- if item doesn't exist, throw an error
if folder of (info for I) then
do shell script "rm -r " & quoted form of POSIX path of I
else
do shell script "rm " & quoted form of POSIX path of I
end if
end try
end delete_item