I have a very unique issue whereby when I have certain Macs accessing our Synology NAS the Mac (Via Office 2016) create temporary files like in the screenshot.

These files are related to the Office autosave feature and should disappear when the document is closed but do not.

I'd like help with creating a script which I can run on a schedule to delete these folders which always have ".sb-" in the name, hence how we can search and delete based on this text string.

Please forgive me but I'm new to shell scripts and don't know much about Linux so help would be appreciated greatly.



1 Answer 1


If you are sure that nothing else will have ".sb-" in the file name then you can automatically delete them with something like this:

find . -type d -name '*.sb-*' -prune -exec rm -rf {} \; 

This will find all files from the directory where it is run, change find . to the starting directory where you want to run this (find <start dir>). For all files it finds with ".sb-" in the file name, find will remove the file with rm.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .