Clean Up invisible mac files

Clean Up application icon, soap and bubbles

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:

  • .DS_Store
  • ._… (dot underscore filename)
  • .FBC…

Notes

.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.

Modifying

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.

Requirements

Mac OS 10.5 (may work with previous versions, 10.3 seems OK)
Download the Clean Up application.

Comments

This article is very useful.

This article is very useful. I have used my Mac for years and did not notice my hard disk is consuming by the useless files. I followed it and cleaned my Mac. Thanks. And I tried to use MacCleaning to do this as well.

To be fair to Apple

To be fair to Apple they are not useless files, they manage certain file attributes & extra data that isn't contained within the actual files. 

eg .DS_Store files keep track of your window layout settings for each folder.

.FBC*** index files track the content of files to allow searching by file content.

It just happens that when you transfer files to a different format of file system (like a FAT formatted USB drive) the Finder converts the extra data to a format that can be used on another Mac. Other operating systems show these files because they have different rules about what to hide from users.

I don't reccommend deleting all the hidden files on a booting system disk, but for external disks that are used on a variety of OS's it is fine to clear them out.

._files on USB Head Unit

I have been having a load of ._ file problems with my USB sticks with regards to playing any MP3 files on my car head unit. I even took a unit back as I thought it was faulty, obviously the guys at the shop have no idea about macs causing this issue. I downloaded this little app. Dragged each folder of music onto it and it has cleaned out every one. I’ve tested it and its brilliant so just wanted to say thanks and pass on this info to anyone having the same issues.

It may cause problems if you drag the whole drive onto it which it did for me so I repaired the USB via disc utility and then did each folder as above.

Thanks again ;0)

I’m on Mac OS 10.7.5

Thanks

It's good to know it's useful :^)

Clean up Mac

Its not only the hidden files that need to be cleaned off but, cache, duplicates, useless language files and universal binaries must also be deleted from Mac disk.

 

I have tried successfuly the Stellar SpeedUp Mac which cleans all the unnecessary files and uninstalls unused applications in just few clicks.

Sorry, you have missed the point of this little tool.

This app is for disks that are used with other OS's or devices such as SD cards that are used in cameras, USB sticks using the FAT format for Windows or Linux…

This app deletes the hidden files that are created because the disk doesn't support OS X metadata, so the Finder stores it in additional files to prevent data loss.

This application is not a 'system cleaner' and it is a bad idea to run this app on a boot disk - I explicitly warn against this case.

Stick to your 'speedup' app if you want to delete system files, but don't complain to me when your apps no longer work.

 

Thank You!!!!!

Was trying to find a way to remove ._ files from a USB drive I use to listen to MP3's in my car. Was searchiing for over an hour before I found your page. Took care of my problem in 5 minutes. Wish I had found this solution earlier.