- [Instructor] While we're on the topic
of Apple specific files starting
with a dot or period,
I'd like to take a few minutes to talk
about another kind of file that the Mac seems
to scatter around.
If we customize anything in a folder view
in Finder on Mac Os, such as placing icons
in custom locations, or changing the view preferences
for that folder, Mac OS will create a file
in that folder called .DS_store.
These DS store files, Short Forward Desktop Services Store,
contain the data for a given folders appearance,
if there have been any Mac OS specific changes made.
And the file can be read by other Mac's
to apply those transformations or preferences when
a folder is viewed there.
For example, if the customizations were made
on a portable or shared disc.
This is not file system metadata.
It's more like a configuration file for Finder.
But these files are common enough that it's important
to know what they are.
And, we should know about them,
because they can contain information
about other files.
In addition to being generated for us,
when we customize a Finder view,
DS store files are also often used
in standalone software installers.
Where we open a disc image file and there's
a little icon with an arrow, or
some other custom background art, pointing
to an alias for the applications folder.
For example, I'll open up a Firefox installer here.
This visual effect is often accomplished
with a pre-designed DS store file and the hidden flag
on other files,
to hide anything that the user shouldn't see.
I'll turn on invisibles here with command, shift, period.
And notice there's some other files.
These items are both invisible, because they start
with a period.
And this disc image has been customized
with a background image.
Stored in this directory.
And it has a custom image set for its volume as well.
This is the big version of this little icon up here.
The icon size and position are stored in a DS store file,
but we don't see that here.
I'll switch over to my terminal.
And move into this disc image.
Here's that DS store file.
For Mac users, these DS store files are, usually,
not a problem if we're working within the GUI.
But, when Mac users work in the terminal or exchange files
with users of other platforms,
the DS store files are more evident.
As long as we don't, actually, need the DS store files
and the customizations they represent,
one strategy we can use to get rid of these files
in a given folder or on a shared disc, or something, is
to run find.-name .DS store-delete.
And usually, if we're exchanging files
with someone on a different platform,
we don't need these files,
because they can't really use them anyway.
Finder will often regenerate these though,
so this procedure is best done as a final step
in preparing a shared disc for distribution.
There are also other tricks for handling these files
in various scenarios.
For example, we can add a pattern for these files
to a .gitignore file, if we're working
with a Git repository that ends up containing some
of these files.
And, various file server protocols can suppress these files
from being created or from being shown
at the server level.
Each user can, also, instruct their Mac
to not create these files on network shares
with the terminal command defaults
write com.apple.desktopservices
DSDon'tWriteNetworkStores true.
DS store files do contain some information that can
be sensitive.
Information, like the names of files in a directory.
Along with other information that's usually less sensitive,
like, whether the Finder window should show a column or
a list view, which tool bars to show, and so on.
While these files are mostly just annoying debris
to non Mac users, if we get our hands on a DS store file,
we can peek inside with a text editor or other program
to see what we can find.
Like Apple double files.
These DS store files are often referred
to as junk by Mac users and non Mac users alike,
because they appear to litter the file system
with useless files, but they have their purpose
and they're a fairly durable way
of ensuring that user customizations
for Finder can persist locally and aren't lost,
when writing files to non Apple file systems.