.DS_Store files in a folder: what they are and how to avoid them

On more than one occasion, after downloading some type of content from the internet or connecting a hard drive or pen drive to our computer, we have found a hidden folder called .DS_Store . What is this file? What is it for? Can I delete it? In this article we are going to answer these and other questions related to this folder with such a strange name.

The first thing we should know about this file is that it is only useful in macOS and Unix, the operating system on which Apple‘s operating system for computers is based. Outside of macOS and Unix, that is, on both Windows and Linux, the DS_Store folder is completely useless.

.DS_Store files in a folder

What is .DS_Store and what is it used for

.DS_Store refers to the Desktop Services Store and is related to the system. These files are automatically generated every time the Finder (macOS file explorer) comes into contact with a drive and are always hidden in both macOS and Windows and Linux. If we connect a pen drive or hard drive to a Mac and, without performing any operation, we safely disconnect it from the computer (previously ejecting the unit), when reconnecting the unit to a PC with Windows or Linux, we will verify how an error has been generated. file with this name.

When you open a drive or directory from the macOS Finder, the system automatically generates the .DS_Store file, a file that stores the position of files and folders along with the size of the Finder window and icon, the display format of the window (list, grid, preview), the number of columns with file information.

The operation of this file is very similar to that of thumbs.db, a file that Windows generated in previous versions to create a directory where a thumbnail of all the images stored in a folder was stored, in this way, when accessing a directory, could show instead of an image icon, a thumbnail of it.

If we deleted this file, we did not lose any data stored on the drive. The only inconvenience we found was that, when accessing a folder or unit with images, this file would have to be generated again, so the initial loading time was longer.

Can I delete them?

As it does not have any utility in Windows , every time we come across .DS_Store files, we can safely remove it from our computer. This type of file only has a function in macOS and Unix, as I mentioned above, since it allows the Finder to know how the data stored on that unit was displayed the last time it was accessed, since this file is modified every time it is accessed from the macOS file explorer, even if we do not make any notable changes.

If we use a Mac, we can also delete these files without any problem, since they do not contain system information, they only store a record of the Finder settings. If we delete them, the Finder will generate a new file again unless we deactivate that option through Terminal, an option that we show you below.

Delete .DS_Store files in Windows

The process to delete the .DS_Store files in both Windows and Linux is exactly the same as the one we follow to delete any other file that is not part of the system. We just have to select it with the mouse, in case of using the graphical interface and drag it to the trash, use the Delete option with the right mouse button or press the Del button.

Delete all .DS_Store files on Mac

If we want to delete all the .DS_Store files found on a Mac, we must open the Terminal application located in the Launchpad , inside the Others folder. We can also access it from Spotlight by typing the term Terminal and clicking on the first result.


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

Before carrying out the process of deleting all the .DS_Store files, the system will request the user password to confirm that we are the legitimate administrators of the computer. If we want to carry out this task, from a standard user account, it will also be necessary to enter the device administrator password.

borrar archivos .DS_Store

This command, which takes a long time to process, will delete all .DS_Store files that are located in non-system folders. As it comes across system folders where it is not possible to delete these files, it will display the path with the result Operation not permitted . It will also inform us of the folders where it has not found this file with the text No such file or directory .

borrar archivos .DS_Store

Prevent them from re-generating

As I mentioned above, deleting these files on Mac is absolutely useless, since they are automatically generated again. macOS allows us to disable the creation of this Finder log file through the following command that we must type in Terminal.

defaults write com.apple.desktopservices DSDontWriteNetworkStores true

If we have changed our minds and find that .DS_Store files are useful, we can restore this function with the code

defaults write com.apple.desktopservices DSDontWriteNetworkStores false

Is it worth keeping this file?

Here everything depends on the needs and use we make of our equipment. If we usually work with a large number of files and folders from the Finder, it is recommended to keep this function activated, since it will avoid us having to resize the window every time to adapt to the number of files we want to show, the type of visualization, the amount of information that is shown of the files from the columns among other functions… since not all the folders store the same number of files / folders.

Opening a full-screen Finder window to show just two files doesn’t make any sense , as we’ll be forced to reduce the size. When reducing the size, the new size of the Finder window will be stored in the .DS_Store file. The next time we access that folder, it will be displayed with the same size that we had previously set. The same happens without changing the size of the icons, the display options…

If the use we make of the Finder is reduced to the minimum expression, keeping this function activated is absurd. However, if we take into account that the size of the .DS_Store files is only a few bytes, removing this function will not allow us to free up space on our computer.

how can i open them

There is no application for Windows or Linux, which allows access to the inside of the .DS_Store files. Having no useful functionality on both operating systems, there is no reason for there to be an app that allows access to its content.

Being a file generated by the system, there is also no application from Apple or third parties that allows us to access its interior to modify its content.