JAMF auto delete download folder
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Posted on 01-03-2023 05:40 PM
Hello - Happy New Year! I have been looking for a script of "auto delete files once the device has restarted"
I found this script but it seems not to be working..
# Fetch the target user if desired, otherwise use the currently logged in user. if [ "$4" != "" ]; then TargetUser=$4 else TargetUser=$3 fi echo "Target user is $TargetUser." # Delete common user spaces of the targetted user. rm -Rf /Users/$TargetUser/Desktop/* rm -Rf /Users/$TargetUser/Documents/* rm -Rf /Users/$TargetUser/Downloads/* rm -Rf /Users/$TargetUser/Applications/* rm -Rf /Users/$TargetUser/.Trash/* exit 0

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-03-2023 06:49 PM - edited 01-04-2023 05:25 AM
Hey! What’s the use case here? Would a guest account be sufficient?
If it’s a shared computer situation, why not just delete all inactive user profiles after “x” amount of days?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Posted on 01-04-2023 05:07 PM
Hello bro! We want to implement the auto delete download files on ALL accounts regardless if it's admin. just like the "deepfreeze" thing on windows. So as long as the device restarted, the download files should be deleted.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Posted on 01-04-2023 08:49 PM
Probably looking for more of a launch daemon then that you can have run after a reboot
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Posted on 01-04-2023 01:36 AM
@TDManila Its recommended to follow @robjschroeder suggestion.
How are you running the script? Login trigger? what does the policy logs show?
Thanks.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Posted on 01-04-2023 05:55 AM
Something like:
DAYS=$4
find /Users -type d -mtime +"$DAYS" -maxdepth 1 -not -path "/Users" -not -path "/Users/admin" -not -path "/Users/Shared" -exec rm -r "{}" \;

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Posted on 01-04-2023 05:56 AM
And then just have a policy run this on a recurring check-in at whatever frequency you would like or works for you.
