Featured image of post What is the DS_Store file of MacOS? What are the effects of deleting the .DS_Store file? How to prevent the MacOS system from automatically creating .DS_Store files? Does Windows have files similar to .DS_Store?

What is the DS_Store file of MacOS? What are the effects of deleting the .DS_Store file? How to prevent the MacOS system from automatically creating .DS_Store files? Does Windows have files similar to .DS_Store?

What is the DS_Store file of MacOS? What are the effects of deleting the .DS_Store file? How to prevent the MacOS system from automatically creating .DS_Store files? Does Windows have files similar to .DS_Store?

Photo by Gabriela Gonzalez on Unsplash

What is the .DS_Store file?

The .DS_Store file is a hidden file automatically created by the macOS operating system, mainly used to store custom properties of folders, such as icon position, background color, and view options.

Item Description
File Name .DS_Store
Full Name Desktop Services Store
Purpose Store display settings of folders, such as icon position, background color, and view options
Automatically Generated When accessing a folder, Finder automatically generates this file
Hidden By default, the .DS_Store file is hidden and does not appear in Finder
Similar Files Similar to the desktop.ini file in Windows
Storage Location There will be a .DS_Store file in every folder accessed by Finder, including folders on remote systems
Impact Deleting it will reset the folder’s display settings, but will not damage the system; a new file will be regenerated upon the next access

What are the effects of deleting the .DS_Store file?

Item Description
Impact After Deletion After deletion, the folder’s custom display settings will disappear and revert to default
No Loss of Important Data Deleting the .DS_Store file will not affect the files or data within the folder, only the display method
Automatically Regenerated The next time the folder is opened, the system will automatically generate a new .DS_Store file
Impact on Users Deleting these files will not cause much trouble, but will lose personalized display settings
Impact in Specific Situations If the .DS_Store file is corrupted, deleting it can resolve certain synchronization issues (e.g., with OneDrive)

Deleting the .DS_Store file mainly affects the display method of the folder, and will not cause significant damage to the system or data. If you do not care about the folder’s personalized settings, you can safely delete them.

Prevent Automatic Creation of .DS_Store Files

To prevent Finder from automatically creating .DS_Store files, execute the following command in Terminal.

defaults write com.apple.desktopservices DSDontWriteNetworkStores true

To restore automatic creation of .DS_Store files, execute the following command:

defaults write com.apple.desktopservices DSDontWriteNetworkStores false

Delete All .DS_Store Files on the System

Execute the following command in Terminal to delete all .DS_Store files on the system:

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

To delete .DS_Store files in a specific folder, execute the following command in Terminal:

find . -name ‘.DS_Store’ -type f -delete

Does Windows have a file similar to .DS_Store?

File Name Description
desktop.ini Used to store display settings for folders, such as icon position and view options. When a user customizes the appearance of a folder, Windows automatically generates this file.
Thumbs.db Used to cache thumbnail files in folders, helping to display images in folders more quickly. When the folder content changes, the system updates this file.

These files play similar roles to .DS_Store in the Windows system, helping the system remember users' custom settings for folders and improve the user experience.

Reference

All rights reserved,未經允許不得隨意轉載
Built with Hugo
Theme Stack designed by Jimmy