Does locking folders prevent .DS_Store being deleted in certain cases?

I deleted .DS_Store from folders via terminal using defaults write com.apple.desktopservices DSDontWriteNetworkStores -bool true as the command because the folders were the wrong font size, some size 12, some size 13 and I couldn't find a way to ensure consistent font size or viewing in list for all folders in Finder, upon updating to Big Sur, and it changed the modification dates for some directories of folders containing files that are used for reference but occasionally used.

I had to tediously use a date-changer to fix the relevant folders 'dates.

If I was to lock a folder or series of folders individually via Finder, any deletion of .DS_Store wouldn't affect the locked folders that already had a .DS_Store at the time and the settings within .DS_Store?

In theory, if there's folders you don't want modifying upon opening, locking before doing any delete .DS_Store is a good or bad idea?

As apple.stackexchange is about answering questions, I would appreciate an explanation since I've done some light Google-ing on the topic.


Yes, locking a folder prevents any files/folders immediately inside of it from being modified, as well as deleting/renaming the folder itself. Items in sub-folders can be edited though.

I should note that the command you had in your question does not delete any DS_Store files, it simply stops them from being created on network volumes.

I'll assume you want to run a find command which deletes all DS_Stores, and yes locking a folder will prevent that from modifying the files in it.