Go Back   MacRumors Forums > Apple Systems and Services > Programming > Mac Programming

Thread Tools Search this Thread Display Modes
Old Apr 8, 2007, 11:16 AM   #1
macrumors regular
Join Date: Mar 2007
file attributes/properties viewer

i want to create a small app that will allow me to view and sort files on the mac by their various attributes/properties. eg, if you are viewing a folder full of mm3's in windows, you can choose detail view and select what attributes to sort the files by, such as bitrate, song duration, etc. the same is possible with images such as sorting by resolution or image format. Windows seems to be able to handle any file type like this. i need to know how are file properties/attributes stored on a mac? i know mp3's have tags( called ID3Tags), and there is something similar for images, but for all other files, is the information stored along with the file, or is it stored within the OS, and how is it viewed? ( i know there are applications that allow me to do this, but i want to do it for myself as a learning exercise)
MBP 2.33Ghz C2D/256 MB VRAM/2Gb Ram/120 GB HD
Itíl have to work very hard to replace my trusty old Dell Inspiron 8500. Il update this when it does!
schmintan is offline   0 Reply With Quote
Old Apr 8, 2007, 01:58 PM   #2
macrumors 601
HiRez's Avatar
Join Date: Jan 2004
Location: Western US
Have a look at the docs for NSMetadataItem.

When I was using this, I had to do a little bit in Carbon to actually get the attributes from a file, but I don't know if that's still necessary. Here is the code for a static utility method I wrote for that (returns metadata associated with a file in a Cocoa dictionary object):
+ (NSDictionary*)metadataForFileAtPath:(NSString*)aFilePath {
	MDItemRef item = MDItemCreate(kCFAllocatorDefault, (CFStringRef)aFilePath);
	CFArrayRef metadataAttributeNames = MDItemCopyAttributeNames(item);
	NSDictionary *metadataDict = (NSDictionary*)MDItemCopyAttributes(item, metadataAttributeNames);
	return metadataDict;
Some of the common metadata attributes for a file are here. You use those names as keys to the dictionary, the values are the metadata as strings.
Go outside, the graphics are amazing!
HiRez is offline   0 Reply With Quote

MacRumors Forums > Apple Systems and Services > Programming > Mac Programming

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Similar Threads
thread Thread Starter Forum Replies Last Post
Mp3 file attributes cool11 Digital Audio 0 Oct 17, 2013 01:02 PM
iPhone: How to see properties of .mp3 file? TheShadowXX Jailbreaks and iOS Hacks 3 Apr 9, 2013 03:09 PM
App to change attributes of file MoodyM Mac Applications and Mac App Store 9 Jan 3, 2013 08:39 PM
Windows file properties on the Mac yanivmeyer Windows, Linux & Others on the Mac 0 Aug 16, 2012 02:26 AM
Cannot open lock in Info window or change any file attributes desertman Mac OS X 10.7 Lion 0 Jul 17, 2012 02:10 PM

Forum Jump

All times are GMT -5. The time now is 06:03 AM.

Mac Rumors | Mac | iPhone | iPhone Game Reviews | iPhone Apps

Mobile Version | Fixed | Fluid | Fluid HD
Copyright 2002-2015, MacRumors.com, LLC