I'm new to scripting and I'm trying to delete all files and folders within the Desktop folder and the Downloads folder without actually deleting the Desktop folder and Download folder themselves. I've tried using rm -rf /users/username/desktop/* , but it prompts for confirmation and then doesn't execute when trying to deploy through Jamf. Does anyone know how to do this? I want the trigger for the policy to be "at logout".
Solved! Go to Solution.
Commands are case sensitive.
rm -Rf /Users/<username>/Desktop/*
Is what I would use.
Deleting just the files should be available to the User, but root can do it too. How is your script being executed? Direct out of Jamf or as a local script. From Jamf it will be running as root. As a local script it could be running as the User.
I am guessing you have a way of finding the username, and adding it to the script?
For Log out I would add it as a script, and then add that to a policy, and set the policy to run at logout.