4.6. .DS_Store Files

In a number of environments that use SMB, AFP, and other file-sharing protocols with Mac OS X, Windows, and Linux clients, OS X leave a number of hidden files behind. If you've managed such environments, you've likely noticed the .DS_Store files and possibly even tried eliminating them. Try as you might, though, always seem to come back. Well, you don't have to live with them.

You can tell your Windows clients not to show hidden files. From Windows XP, open Windows Explorer from the Start menu, an icon, or via the command line (explorer.exe is the executable). Select the Tools menu, then Folder Options..., click on the View tab, then mark the Do not show hidden files and folders radio button. For Vista and up, open the Folder Options control panel, choose the View tab, and then select Do not show hidden files and folders.

If this proves unwieldy, though, you can prevent each Mac OS X user account from making the .DS_Store files. This isn't to say you should —OS X uses the files to track the view and icon placements of a folder. But if you need to get rid of the files, you need to get rid of them.... To do so, create a file called com.apple.desktopservices.plist in the ˜/Library/Preferences folder of each user account. Its contents should be:

{
DSDontWriteNetworkStores = true;
}

The easiest way to go about this is on a single system is simple to run the following command for each user:

defaults write com.apple.desktopservices DSDontWriteNetworkStores true

If, however, you have a large number of clients and use Open Directory, you'll want to push out the com.apple.desktopservices.plist as a managed preference—or, for future users, you can drop the file into /System/Library/User Template/English.lproj/Library/Preferences. Now the file is part of the user template. We discuss managed preferences extensively in Chapter 7: Client Management. Note that after following this procedure, you should probably reboot. Also, though setting this option will keep new .DS_Store files from being generated on network volumes (aka network stores), it won't do so for local volumes, including those on an Xsan (since Xsan volumes are basically interpreted by the finder as local volumes, in this context).

Once you've disabled the creation of new .DS_Store files, you'll probably want to eliminate those already on the volume. Use the find command in conjunction with the -name and -exec flags followed by rm as (replacing path to share with the path to your actual share). Here's the syntax:

find /path to share -name .DS_Store -exec rm {} ;

For the command to process correctly, the account under which it's running must be able to access files in all folders of the tree where .DS_Store files may exist. If you find new .DS_Store files appearing after you've followed all these procedures, look at the owner of the new files. Typically you'll find that your procedure skipped that user's account.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.14.15.94