Tim
Tim

Reputation: 14446

Mac - Monitoring file moves / renames

I'm considering creating a file manager that keeps track of files on a user's system, but stores its metadata separately.

Is there a way to detect if a user moves a file outside of my application (or while my application isn't running) to know where the file moved to? For example, if a user has a photo stored in ~/Desktop/pictures (and my database has this as an entry), and they move it to ~/Documents/My Pictures, I'd like to be able to keep a reference to it still - is there a way to do this? Similarly, if they rename the file, I'd like to know it's the same file.

In other words - can you ask the system to notify you of changes to files' names and paths? Is there an application-accessible identifier for files which contains the proper reference irrespective of its actual name or path?

I'm new to the Cocoa API on the desktop; I'm one of those who learned Obj-C on iPhone programming and would like to apply it to the desktop.

Upvotes: 4

Views: 734

Answers (1)

John Calsbeek
John Calsbeek

Reputation: 36547

Yes: it's called "bookmark data", and has existed in this form since Mac OS X 10.6. If you need to use it on older version, you're looking for the Alias Manager.

Upvotes: 8

Related Questions