5

I manage a very modest macOS server (Late 2014 Mac Mini, Mac OS 10.12.4, Server 5.3) that supports several sharepoints for about 20 clients - a mix of macOS and Windows. I typically have my work machine set to 'AppleShowAllFiles TRUE' so I notice that the shares are accumulating '.smbdelete...' files. These are hidden for most users, but they are getting a little annoying for me because the file listing of one share in particular is getting long. From web searches, it looks like this has to do with macOS' handling of SMB connections to shares.

So two questions:

  1. Can these be safely deleted?
  2. Can the accumulation of these be halted.

2 Answers 2

7

Find:

sudo find . -name '.smbdeleteAAA*' \( -type d -exec find {} \; -prune -o -print \)

Delete:

sudo find . -type f -name '.smbdeleteAAA*' -print0 | xargs -0 rm -f
1
  • find . -name '.smbdelete*' -delete Maybe cleaner (to me at least).
    – cucu8
    Commented Apr 4, 2022 at 10:11
3

Spotted an answer on the Apple support forums: https://discussions.apple.com/message/30046649#message30046649

Apple introduced this behavior in OS X 10.10 you can find it in the source code here:

http://www.opensource.apple.com/source/smb/smb-759.40.1/kernel/smbfs/smbfs_smb.c

The comment above the code that does it is:

* We have an open file that they want to delete. Use the NFS silly rename
* trick, but try to do better than NFS. The picking of the name came from the
* NFS code. So we first open the file for deletion. Now come up with a new 
* name and rename the file. Make the file hidden if we can. Now lets mark
* it for deletion and close the file. If the rename fails then the whole call 
* should fail. If the mark for deletion call fails just set a flag on the 
* vnode and delete it when we close.

Other googling implies that these are held while 'someone' has an open file handler and are cleaned up automatically later.

You must log in to answer this question.

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