/unmac

cleanup Mac auxiliary files like .DS_Store, __MACOSX, etc.

Primary LanguageRubyMIT LicenseMIT

unmac -- Delete spurious Mac files under a directory or volume

Usage:
  unmac [OPTIONS] directory ...

Options:
  -h, --help                       Print this help
  -v, --verbose                    Show processing
  -p, --pretend                    Show what would be deleted, but don't do it
  -s, --keep-spotlight             Do not delete Spotlight data
  -f, --keep-fsevents              Do not delete Time Machine stuff
  -t, --keep-trashes               Do not delete volume trashes
  -c, --keep-document-revisions    Do not delete document revisions
  -b, --keep-mobile-backups        Do not delete mobile backups
  -m, --keep-macosx                Do not delete "__MACOSX" directories
  -r, --keep-dsstore               Do not delete ".DS_Store" files
  -d, --keep-apple-double          Do not delete "._*" ghost files
  -o, --keep-apple-double-orphans  Delete "._foo.txt" only if "foo.txt" exists
  -i, --keep-custom-folder-icons   Do not delete custom folder icons

Description:
  When a Mac copies files to volumes that have a different file system it adds
  some auxiliary files that represent different kinds of metadata. This typically
  happens with memory sticks, network drives, SD cards, etc. Mac archivers like
  zip(1) add special files as well, like "__MACOSX", you'll see them
  for example if you extract a Zip file like that on Windows.

  The purpose of these special files is to let another Mac rebuild the metadata
  from them, Spotlight integration, etc. But if you are not interested in these
  features your directory or volume just gets cluttered. This utility removes
  all those extra files.

What's deleted:
  This is just a summary, for more detailed explanations and pointers see the
  comments in unmacer.rb:

    * Spotlight leaves a folder called ".Spotlight-V100" in the root directory
      of volumes.

    * Time Machine relies on a folder called ".fseventsd" in the root directory
      of volumes.

    * A folder called ".Trashes" in the root directory of volumes stores their
      trashes. Those ones are taken into account by the Trash in the Dock.

    * Document revisions are stored on a folder called ".DocumentRevisions-V100"
      in the root directory. (New in Lion.)

    * Mobile backups are stored on a folder called ".MobileBackups" in the root
      directory. (New in Lion.)

    * Some archivers create auxiliary directories called "__MACOSX".

    * Finder and Spotlight data related to each folder gets stored in an
      extra file called ".DS_Store".

    * For each file "foo.txt", its resource fork and some additional stuff
      are stored in an accompaining ghost file called "._foo.txt". The pattern
      is to prepend "._" to the original file name.
    
    * If a folder has a custom icon you get a file "Icon^M" (that ^M is a hard CR).

  Some stuff is only found in the root folder of volumes, unmac looks for them
  in any directory you pass as argument, but not on their subdirectories.