Clean Up invisible mac files
This is an AppleScript application to remove certain invisible files from a disk. The main purpose is for cleaning up certain 'meta' files the Mac Finder creates on volumes. The invisible files can be annoying when the disk is used with other operating systems that will show the items. This AppleScript droplet is useful for cleaning memory sticks for cameras, PSP's, mobile phones, USB thumb drives etc. I don't recommend running it on a disk that is used for booting from, it may cause issues, or the results may just really annoy you (loosing all the Finder comments, window settings, the ability to search within content etc).
The files it removes by default are:
- ._… (dot underscore filename)
.DS_Store files store file comments & data about window layout preferences.
._… (dot-underscore) files are resource forks that usually get created via Finder copying. The resource forks are named similarly to the data fork (the actual file data) but with a '._' at the start eg 'My picture.jpg' has (an invisible) '._My picture.jpg' resource fork created in the same location.
.FBC… are index files, used by FindByContent for finding text inside files.
The script will perform a find, and then delete the above items. It will pass through the whole disk directory structure, so every folder will be cleansed.
There is no way to recover the items (unless you have made a backup), they get deleted immediately, so you can't get them back from the Trash.
This is not necessary but the script can be altered to remove or leave files inplace.
The AppleScript can also be edited to delete the Trash (only on the volume in question) and delete .fseventsd folders but the script will ask for an admin username & password when performing these extra steps. Open the application in Script Editor (see the ReadMe for more info).
How to use
The application is a droplet, so drag the desired disk onto it and it will delete the items from the entire disk. You will be asked to confirm before it runs. On success it quits, or may report an error if it was unable to delete all the files.
The main power behind the script is the use of the 'find' command a built in Unix command
You can achieve the same steps as the script by using the following in Terminal
find "/Volumes/Name of Disk" -type f -name ".DS_Store" -delete
Deletes .DS_Store files
find "/Volumes/Name of Disk" -type f -name "._*" -delete
Delete ._ dot underscore files
find "/Volumes/Name of Disk" -type f -name ".FBC*" -delete
Delete .FBCIndex files
Optional commands (off by default)
find "/Volumes/Name of Disk" -type d -name ".Trashes" -delete
Clears the Trash for every user that has items in the Trash
find "/Volumes/Name of Disk" -type d -name ".fseventsd" -delete
Clears out File System Events data, this seems to fail occasionally, hence it being turned off by default.
There is other 'detritus' that could be removed such as the following folders, but they don't generally cause trouble so I leave them alone.
.Spotlight-V100 The main spotlight index for this volume
.TemporaryItems What it says, Temporary items.
Any questions use the contact form.
Mac OS 10.5 (may work with previous versions, 10.3 seems OK)
Download the Clean Up application.