Dear Aunt TUAW: What are those duplicate files?

Dear Auntie TUAW,

Since Installing Lion, when I copy files to a PC compatible hard drive it creates duplicate unreadable files with and underscore in front of it.

filename.mov
_filename.mov

It makes sorting through files a nightmare as I never had this problem with Snow Leopard. What has changed and can I hide these automatically?

Cheers,
Sanj

Dear Sanj,

What you’re seeing there is metadata lint, copied over from your Mac’s HFS+ drive. The Hierarchical File System (Plus!) was developed by Apple for it Mac computers. The extra file name (which has a period in front, by the way, so it’s ._filename.mov, not filename.mov) contains all the extended attributes for your copied file. And because of that extra period, it’s normally invisible.

These attributes typically contain information about the data formats in use as well as other curious items like the kMDItemWhereFroms field, which shows where your data files were downloaded from. You can see some of this by opening the metadata file in a text editor, although I warn you in advance that it’s a heavily binary format, so the useful bits are few and far between.

It’s easier to start taking a look at your metadata from the OS X side of things. In the Terminal, you can use the mdls utility at the command line, e.g.

% mdls ~/Desktop/cat.gif

This lists all the metadata information associated with the file, including (for GIF files), the color space, bits per sample, the universal type indicators (public.image, public.data, etc), content update dates, physical sizes, etc.

You can access and edit these attributes with a second utility, xattr. For example, you can list the custom attributes embedded into the file

% xattr cat.gif
com.apple.metadata:kMDItemDownloadedDate
com.apple.metadata:kMDItemWhereFroms

Or you can add your own attribute

% xattr -w com.sadun.foo “HELLO” cat.gif

You might want to print out the value of any attribute

% xattr -p com.sadun.foo cat.gif
HELLO

Or you might want to recursively strip an attribute from all the files in some hierarchy, e.g.

xattr -r -d com.apple.metadata:kMDItemDownloadedDate *

So your answer in a nutshell is this. The extra file you see is the same data that’s normally hidden in the OS X file system and made available to apps and utilities like these through system calls. Feel free to delete the extra items if you like or keep them around for better compatibility with OS X when you use the PC-formatted drives.

As for the actual deletage, it’s a lot easier to do at the command line than trying to slog through things in Finder, where those extra bits are supposed to be hidden by default.

Hugs,

Auntie T.

Dear Aunt TUAW: What are those duplicate files? originally appeared on TUAW – The Unofficial Apple Weblog on Mon, 08 Aug 2011 11:00:00 EST. Please see our terms for use of feeds.

Source | Permalink | Email this | Comments

Leave a Reply

Your email address will not be published. Required fields are marked *