Clear Browser cache/history/cookies with SwiftDialog UI

ScottEKendall
Contributor

This one grew out of necessity at my old job.  The higher level VPs didn't want to go into each browser settings and clear their cache/cookies/history when asked to do so, so I tried to create a "one stop shop" to work on all installed browsers with a single click.  The goal was to keep their bookmarks, extensions & tabs intact...and it works "for the most part".  If anyone knows critical directories / files that should be kept during a cleanup, by all means, let me know and I can get it put into the code.  Hopefully you find this app useful.

Code is here: https://github.com/ScottEKendall/JAMF-Pro-Scripts/blob/main/ClearBrowserCache.sh

Screenshot 2025-02-21 at 10.18.50 AM.png

4 REPLIES 4

dletkeman
Contributor III

Nice idea!  Looks like the link is broken though:

dletkeman_0-1740167820431.png

Keep these coming!  You're doing good work here.

Link should be:
https://github.com/ScottEKendall/JAMF-Pro-Scripts/blob/main/ClearBrowserCache/ClearBrowserCache.sh

ScottEKendall
Contributor

yea...I am busy moving everything into files with appropriate READMEs and pictures..for some reason, I cannot change my original post to change the links I posted..

 

This is probably the best link to use: https://github.com/ScottEKendall/JAMF-Pro-Scripts

 

SMR1
Contributor III

@ScottEKendall Hey Scott, I'm in the process of trying this script out. I'm not very good at scripting. I changed the portion that uses the .png file, but when I run the script via self service i get the error message. Am I missing something. What I changed was below. I just changed the top one to /Users/Shared and the bottom one to /Desktop/our.png. Thanks in advance.

SUPPORT_DIR="/Library/Application Support/GiantEagle"
SD_BANNER_IMAGE="${SUPPORT_DIR}/SupportFiles/GE_SD_BannerImage.png"

 

Script result: Ensuring that swiftDialog version is installed...
tee: /Users/Shared//logs/CleanBrowserCache.log: No such file or directory
2025-05-29 11:41:16: Ensuring that swiftDialog version is installed...
Swift Dialog is currently running: 2.5.6.4805
tee: /Users/Shared//logs/CleanBrowserCache.log: No such file or directory
2025-05-29 11:41:16: Swift Dialog is currently running: 2.5.6.4805
Clearing Google Chrome cache
tee: /Users/Shared//logs/CleanBrowserCache.log: No such file or directory
2025-05-29 11:41:25: Clearing Google Chrome cache
Backup file: bmpbcphgifhfkfjioddeenggdpffbgek
tee: /Users/Shared//logs/CleanBrowserCache.log: No such file or directory
2025-05-29 11:41:25: Backup file: bmpbcphgifhfkfjioddeenggdpffbgek
Backup file: egaejpfbkjamgheoingidhokbfnidlpi
tee: /Users/Shared//logs/CleanBrowserCache.log: No such file or directory
2025-05-29 11:41:25: Backup file: egaejpfbkjamgheoingidhokbfnidlpi
Backup file: mdkgfdijbhbcbajcdlebbodoppgnmhab
tee: /Users/Shared//logs/CleanBrowserCache.log: No such file or directory
2025-05-29 11:41:25: Backup file: mdkgfdijbhbcbajcdlebbodoppgnmhab
Backup file: miinajhilmmkpdoaimnoncdiliaejpdk
tee: /Users/Shared//logs/CleanBrowserCache.log: No such file or directory
2025-05-29 11:41:25: Backup file: miinajhilmmkpdoaimnoncdiliaejpdk
Backup file: nmmhkkegccagdldgiimedpiccmgmieda
tee: /Users/Shared//logs/CleanBrowserCache.log: No such file or directory
2025-05-29 11:41:26: Backup file: nmmhkkegccagdldgiimedpiccmgmieda
Restoring Google Chrome files
tee: /Users/Shared//logs/CleanBrowserCache.log: No such file or directory
2025-05-29 11:41:26: Restoring Google Chrome files
Restoring Extensions
tee: /Users/Shared//logs/CleanBrowserCache.log: No such file or directory
2025-05-29 11:41:26: Restoring Extensions
Restoring Favicons
tee: /Users/Shared//logs/CleanBrowserCache.log: No such file or directory
2025-05-29 11:41:26: Restoring Favicons
Restoring Preferences
tee: /Users/Shared//logs/CleanBrowserCache.log: No such file or directory
2025-05-29 11:41:26: Restoring Preferences

  

ScottEKendall
Contributor

yep...this line 

/Users/Shared//logs/

shows that your LOG_DIR variable (line #38) is not correct...Also check line #35...that is the "root" of the support directory