How does one disable Mac OS X from generating. ds_store files on external devices? And how to delete. ds_store files in batches?
Http://www.java2class.net/bbs/viewthread.php? Tid = 254
Background information
. The ds_store file (Desktop Services Store) is a hidden file that is stored in every directory. It stores some specific attributes of the file directory, metadata, it is similar to thumbs in Windows operating system. DB, desktop. INI file.
If the hidden file is not opened in Mac OS X for display, the. ds_store file will not be seen in the finder and will not be in the way of the problem. However, when switching files from other machines or USB files to other operating systems, such as Windows operating systems, when the hidden files are also displayed, in this case, the hidden files will be especially redundant, space-consuming xyz, and file compression will be included in the compressed files, for external devices, SMB, and AFP remote network connections.
Solution
Log on to terminal, run defaults write com. Apple. login topservices dsdontwritenetworkstores true, and then log off and log on to or restart Mac OS X;
If there are multiple users on the machine, all users perform this operation once; or copy the newly generated com. Apple. Topics topservices. plist file to ~ /Library/preferences directory.
Although this method can prevent Mac OS X from being generated again on the external device. ds_store files, but existing files cannot be deleted directly by you. You can only manually delete them in batches. Run the following command:
Find/-name ". ds_store"-type F-delete
However, the above command still cannot generate the. ds_store file on the local file system !!!
In this case you can use asepsis: http://asepsis.binaryage.com, which will create. the ds_store file is redirected to another specified directory, which prevents the file from being generated in each directory. ds_store file. The default directory is/usr/local /. dscage: run the asepsisctl clean command to clear the files in the redirected directory.
Implementation Principle
Mac OS X implements a private system framework named topservicespriv, which is responsible for creation and operation. ds_store files, finder and other applications also use this framework. Use topservicespriv to use standard libc calls for operations. the ds_store file is created and operated by encapsulating topservicespri. when the ds_store file is added with the specified directory as the prefix,. the operations on the ds_store file are redirected to a specific directory.
The file directory needs to be concise, so that the world is quiet!
References:
Http://en.wikipedia.org/wiki/.DS_Store
Http://danilo.ariadoss.com/how-to-recursively-remove-ds_store-files-on-mac-os-x/
Http://www.chrisnovoa.com/os-x-lion-ds_store-disabling/
Http://support.apple.com/kb/HT1629
How does one disable Mac OS X from generating. ds_store files on external devices? And how to delete. ds_store files in batches?