2 years ago

.DS_Store what is that crap?
#ds_store #crap #mac #why #ihateit #article


Have you ever encountered files in your file system called ".DS_Store"? If so, have you ever wondered why they are there?

If you have one or more files in your system called .DS_Store than very likely you are either a Mac user yourself or dealing with Mac users. The files are very much hated, especially on shared file systems on which there are some Mac users.

The main file browser of MacOS, or MacOS X or OS X, Apple has the tendency to rename it every now and then, but the main file browser is an application called "Finder". This is the application that is responsible for those files. Whenever Finder accesses any directory in a file system it will create the file .DS_Store when it's not yet available. There is no way to turn it off and although there have been addons for Mac in the past that made it possible to keep .DS_Store files out to replace it with a more clever system, Apple insists to ruin your file system with them, and those addons have been blocked. After all Apple owns your Mac and you only have permission to use it... At least, that's what Apple thinks, as I have a different opinion. There's a reason I quit Mac despite it being far better than Windows on many fronts.

All a .DS_Store file contains is just some quick configuration and metadata specific to that directory. The data itself is completely harmless, and you can just delete it and Mac will just create it anew whenever it sees its missing.

But just because the data is harmless, that doesn't mean those files in question are in definition harmless. First of all, like any other kind of file .DS_Store files can get corrupted, and based on the kind of corruption Finder can suffer. Of course you can still use the terminal to delete the file if the Finder crashes, but most Mac users are not quite comfortable with Unix commands. MacOS is just a Unix application after all, and the "OS" is a bit misleading as Darwin, an open source variant of Unix is the true operating system of Mac, and also of iPhone and iPad for that matter, well any Apple device. And I said it before, I've seen many many complaints already on professional shared networks where Windows, Linux and Mac users are on the same network. Since MacOS will just create the .DS_Store files on the shared file systems some companies spend a lot of money removing them all every time, however being a coder myself I laugh about that since there are very cheap ways to completely clean a file system of .DS_Store files... Although when you are fond of SymLinks, then it can get problematic, although even then there are ways to get rid of them. Those who've been using github a lot and nosed a lot in other people's repositories, particularly the repositories that have to be compatible with Mac as well may have seen .DS_Store in the .gitignore file, and for good reasons too. I also know that itch.io's Butler tool is even specifically coded to ignore .DS_Store files.

Now aside from spooking up file systems, the .DS_Store files may be small, but on large complex file systems there will still be loads of them, and then suddenly there can be a lot of useless data on your file system. I did once code a tool specifically set up to remove all .DS_Store files and reported how much bytes got free in the process. It did come to a total close to TWENTY MEGABYTES, which is for just some quick configuration and metadata really absurd and even unacceptable, and also downright stupid. This completely fits the Dutch proverb "Vele kleintjes maken een grote" which literally translates to "Many little ones make one big one". The .DS_Store files really prove the that proverb to be true.

If the .DS_Store files end up on Windows file systems and have to be removed afterward all the time you risk extra fragmentation which can eventually lead to software and in extreme cases even hardware failures unless you defragment your device regularly.

Are there any quick ways to get rid of .DS_Store files?
Yes there are. And if you don't wanna write a dedicated tool for this, there are fortunately some other ways to do this, but it does require a bit of knowing how command consoles work. Best is not to do an entire device in once.... Too much data to process. But if you take down all directories in a device's root, you get pretty far.

I've found the tool RAR, to be quite useful for this. Yes an archiver, believe it or not.

		
			cd <the directory you want to clean of .DS_Store files>
rar m -r crap.rar .DS_Store
rm crap.rar
		
	

The example above should work on Mac, Linux and on Windows in Powershell, and if you hate PowerShell you can do the same in cmd but them you have to replace the rm command with "del crap.rar"

Rar will then just archive all .DS_Store files it finds, but the "m" command (meaning "move") will delete all successfully archived original files, meaning all .DS_Store files disappear in the process. Since you don't need the archived .DS_Store files you can just delete the created archive. Now if you don't have rar, most systems have zip installed by default and then this should also work, although I've never tried it:

		
			cd <directory to purge>
zip -m -r crap.zip .DS_Store
rm crap.zip
		
	

Basically all command line based archive utilities should technically be able to do this, although the exact command will differ per utility.

Now if you are a Mac user it may be no use to do this on the folders you only use yourself. However when you share stuff with others, make sure you remove them. Also if you archive any directory on your system in order to share them, make sure all .DS_Store files are removed from those directories or from the archives you create.

.DS_Store is a really awful disease Mac suffers from. Not that Apple cares, but your not-mac-using friends will thank you for making sure .DS_Store files are not distributed with whatever you share with them.... And this for many reasons. They are hated, for good reasons.

1


0 comments

Loading...

Next up

Why do people wanna be a #moderator? Is it really such a #cooljob?

Killing only brings you so far!

BallPlay future

Game redo on Cynthia Johnson

Disney Princesses go to Hogwarts

Celebrities (almost) killed by one of their biggest fans

Current situation on TFT REVAMPED

A #phrase of #wisdom from the French scientist and philosopher #BlaisePascal Two stories, the one tied to this game (new version), and a prequel novel based on this game have this quote. Perhaps you understand why....

Can you see why this pyramid deal could never be solved from the start (regardless what the already removed cards are)?

A few facts and fables about fire.