Disable local SMB directory enumeration caching

You can disable local caching so that you always see a list of current files and folders on an SMB share.

When you use an SMB 2 or SMB 3 connection, local caching is enabled by default. You might want to turn off local caching if content on the server changes frequently, or the Finder sometimes shows only a partial list of the contents of a share or folder for a few seconds. (On busy or large file shares when using OS X El Capitan or macOS Sierra, items might disappear from Finder while the local cache rebuilds.)

Follow these steps, based on whether your macOS client computer has an /etc/nsmb.conf file.

If your Mac has /etc/nsmb.conf

Open nsmb.conf as root, then set the dir_cache_max_cnt value to zero by adding these lines to the file:

[default]

dir_cache_max_cnt=0

Save the file, then disconnect any mounted SMB shares and reconnect them so that the changes take effect.

If your Mac doesn’t have /etc/nsmb.conf

Open Terminal, then enter these commands to create an nsmb.conf file that has a dir_cache_max_cnt value set to zero:

sudo -s

echo "[default]" >> /etc/nsmb.conf

echo "dir_cache_max_cnt=0" >> /etc/nsmb.conf

exit

Disconnect any mounted SMB shares, then reconnect them so that the changes take effect.

Published Date: