Originally Posted By: joemikeb
Not every folder gets a .DS_Store file. A DS_Store file is only created when the view for a particular folder or the location of the window on the desktop is modified.

The only application that creates, reads, or updates a .DS_Store file is Finder. Finder stores all sorts of information in the .DS_Store file, creating it when it has something to store. View settings are only a part of what Finder stores there.

Finder will create a .DS_Store file in a folder if:
  • You view the non-empty folder in Icon view (so it can save the icon positions of the items).
  • Any item in the folder has a Spotlight comment (so it can save the comment).
  • Any item in the folder has a preview (so it can cache the preview).
  • You change the view settings of any sub-folder (so it can save the sub-folder's view settings). Note that merely changing the view of a window does not necessarily change the view settings for the folder it's viewing.
  • You change the view settings, icon position, or Spotlight comment of the folder itself, and the .DS_Store file for the parent folder cannot be modified. (The .DS_Store file inside a folder will substitute for the .DS_Store file of the folder's parent, but only if needed.)
The creation/updating of the .DS_Store file may be postponed until Finder quits normally, which usually happens at logout. It will be postponed forever if Finder cannot create/update the .DS_Store file.