So I want to be able to have a script that can be run over again not just once, where I can delete multiple folders from different locations.
Not sure how to go about this would love any feedback. thanks
So I want to be able to have a script that can be run over again not just once, where I can delete multiple folders from different locations.
Not sure how to go about this would love any feedback. thanks
Welcome to Macscripter.
What are the folders? Are they always at the same paths?
I’m not clear why this is a forum post instead of a Google search, it is easy to find the syntax to delete files and folders with Applescript.
tell application "Finder"
delete alias "Mackintosh HD:Users:[username]:[filepath]"
end tell
You can put any number of “delete” statements between the “tell” and “end tell.”
If you have any trouble with the script, please post what you have and what’s happening.
Not working, just getting syntax errors.
“Expected “end” or “end tell” but found unknown token.”
My Script: (my drive name is “macOS High Sierra”; FYI)
tell application “Finder”
delete alias "macOS High Sierra:Users:[username]:[/private/var/db/BootCaches/681C984D-F7FA-48CF-A567-77C4A3ACDA35/app.com.apple.FaceTime.playlist]”
delete alias “macOS High Sierra:Users:[username]:[/private/var/folders/d0/f9hlgqz94cz9b7fz2_7b6t6m0000gn/C/com.apple.FaceTime]”
delete alias “macOS High Sierra:Users:[username]:[/private/var/folders/d0/f9hlgqz94cz9b7fz2_7b6t6m0000gn/C/com.apple.FaceTime.FaceTimeNotificationCenterService]”
delete alias “macOS High Sierra:Users:[username]:[/private/var/folders/d0/f9hlgqz94cz9b7fz2_7b6t6m0000gn/T/com.apple.FaceTime]”
delete alias “macOS High Sierra:Users:[username]:[/private/var/folders/d0/f9hlgqz94cz9b7fz2_7b6t6m0000gn/T/com.apple.FaceTime.FaceTimeNotificationCenterService]”
delete alias "macOS High Sierra:Users:[username]:[/Users/sl5887/Library/Containers/com.apple.FaceTime]”
delete alias "macOS High Sierra:Users:[username]:[/Users/sl5887/Library/Containers/com.apple.FaceTime.FaceTimeNotificationCenterService]”
end tell
any insight let me know.
Four issues:
You are discouraged from deleting invisible system files unless you know what you are doing.
In the user folder you can delete both folders with
set userFolders to {"/Users/sl5887/Library/Containers/com.apple.FaceTime", ¬
"/Users/sl5887/Library/Containers/com.apple.FaceTime.FaceTimeNotificationCenterService"}
repeat with aFolder in userFolders
do shell script "/bin/rm -rf " & quoted form of aFolder
end repeat
Files and folders which are owned by the system can only be deleted by appending with administrator privileges to the do shell script line. It prompts you to enter an admin password