# Easy Ways to Erase Cache on Your Mac After Adobe After Effects Usage

I’ve been working with automation for a while now and have recently developed a script that quickly removes the cache from certain locations. Here’s what the script looks like:

```dart
on deleteContents(targetFolderPath)
	try
		set targetFolder to POSIX file targetFolderPath as alias
		
		tell application "Finder"
			set folderName to name of folder targetFolder
			
			delete every item of folder targetFolder
		end tell
		
		set dialogmessage to "Contents of the folder '" & folderName & "' have been moved to the trash successfully."
		display notification dialogmessage with title "Clear Cache" -- subtitle "secondLine"
		
	on error errMsg
		display dialog "Error: " & errMsg buttons {"OK"} default button "OK"
	end try
end deleteContents
on getTruePath(relativePath) -- spaces in path okay 
	set cmdString to "echo " & relativePath
	set cmd to do shell script cmdString
	return cmd
end getTruePath


deleteContents(getTruePath("~/Movies/CacheClip")) -- davinci resolve
deleteContents(getTruePath("~/Library/Caches/Adobe/After Effects"))
deleteContents(getTruePath("~/Library/Caches/Adobe Camera Raw 2")) -- adobe 
deleteContents(getTruePath("~/Library/Caches/com.teamviewer.TeamViewer"))

try
	tell application "Finder"
		with timeout of 1800 seconds
			empty the trash
		end timeout
	end tell
on error e
	display dialog "Finder error emptying trash: Trash is already empty: " & e
	return false
end try


tell application "Script Editor" to activate
display dialog "Trash has been emptied. Cache clearing complete."
```

I’ll just load this into “Script Editor” and it’ll remove all the cache from my computer flawlessly generated from Davinci Resolve, After Effects, Camera Raw 2, and even Teamviewer. I usually have to run this after I’ve been editing video for some time. Let me know if this helps you. Toodaloo.
