Why does Finder modify the date even if you’ve not changed anything in the folder

finderfoldersterminal

Using a MacBook Pro 2020, Big Sur 11.3.

I've noticed recently when viewing folders via Finder that sometimes it modifies them to today's date.

I did foolishly delete all .DS_Store files using this terminal command:

sudo find / -name ".DS_Store" -depth -exec rm {} \;

to try and fix beachballing in a corrupt account in Catalina, before upgrading, re-naming the old account and moving files across to a new admin account where they are now.

I don't have beachballing in the new admin account anyway.

What I've wondered is why some folders, which date back to Nov. 2020 or March 2021 immediately get a file modification date of "Today at [TIME]" even if I've just viewed them, not modified them?

I had to change some via A Better Finder Attributes and it was a slow-ish process.

Locking folders is probably a last step to prevent this, but I don't need to lock folders often.

In general, what's a good solution to ensure Finder has the same view settings across all folders and am I wrong in thinking it will change modification dates of files/folders that are occasionally accessed, even if their contents are not modified?

Any help is welcomed.

Best Answer

The Finder application creates and updates a .DS_Store file when accessing a directory. This file holds the custom attributes of its containing directory, such as the position of icons or the choice of a background image.

This is the reason you see some folders (directories) with a modification timestamp more current than any of the contents of the directory.

To disable this functionality for network shares, use the Terminal application and enter:

defaults write com.apple.desktopservices DSDontWriteNetworkStores true

After this, reboot. No new .DS_Store will be created and you can remove the old ones.

There are no native solutions for handling local volumes. You might look to third-party solutions.