Re: Creating unique numerical representation of file path?
Re: Creating unique numerical representation of file path?
- Subject: Re: Creating unique numerical representation of file path?
- From: "Mark J. Reed" <email@hidden>
- Date: Sun, 14 Oct 2007 18:37:06 -0400
A more generic Unix solution would be
find / -inum 1234
Although it's slower than md since it doesn't use an index. (Even
though the "I" in "i-node" stands for "index". You can use the inode
to access a file directly without having to know the path - but since
there can be many equivalent paths, they're not stored in the inode.
So if you want the path name given an inode, you have to do an
exhaustive search...)
On 10/14/07, Philip Aker <email@hidden> wrote:
> On 2007-14-10, at 00:08, Richard Rönnbäck wrote:
>
> > The file ID numbers look interesting, I will try to find out more
> > and I would appreciate if you have more useful info on the subject!
>
> Those are the inode-numbers. Also available in MetaData.osax. Here's
> how a mapping would work with that route:
>
> set fid to (item 1 of (md info for "~/Desktop/xcode.txt" reporting
> kMDItemID))
>
> fid's kMDItemID -- store this number
>
> Later, get it with:
>
> md query "kMDItemID=" & item_id in directories (path to desktop)
> reporting kMDItemPath
>
> This will work even if the query directory is "/".
>
>
> > Uuids look very interesting but I see a potentially huge problem,
> > in that it seems impossible to generate the same number for the
> > same path again, which the pessimist in me can see would be needed
> > if let's say the file etc holding the mapping pairs gets corrupted
> > or destroyed. They will however come in very handy in another part
> > of the project!
>
> True. The whole idea of UUIDs is that they are unique.
>
> §
>
> Thanks for bringing up this topic -- interesting problem and the md5
> solution is something I wouldn't have thought of.
>
> Philip Aker
> email@hidden
>
--
Mark J. Reed <email@hidden>
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden