The following illustrates one way to accomplish the goal with a script.
# Get a list of users, filtering out service accounts, root, daemon, and nobody...
users=$(dscl . list /Users | grep -v -e '_' -e 'root' -e 'daemon' -e 'nobody')
# Loop through the list of users.
for user in "$users"; do
# Put the path to the directory in a variable.
# The quotes escape the spaces.
$dir="/Users/$user/Library/Group Containers/UBF8T346G9.Office/User Content.localized/Templates.localized/"
# For each $user, delete the directory if it exists.
if [ -d "$dir" ]; then
rm -rf "$dir"
# These variables are no longer needed.
Execute the following portion first to make sure that the list of users is expected and correct.
dscl . list /Users | grep -v -e '_' -e 'root' -e 'daemon' -e 'nobody'
After creating the script, it probably needs to be executed with
sudo. If the script name is