Home All Groups Group Topic Archive Search About

Is there any way to keep a reference to a file even if it is moved or renamed?

Author
1 Sep 2006 3:20 PM
google
My company has a large filesystem that holds hundreds of thousands of
documents related to the business. Sometimes I have the need to keep
metadata for some of the documents. This data could be comments, or the
document's status in a process, etc.

The simplest way to do this is to keep the metadata in a database and
reference the file's full path. The biggest problem with doing it this
way is if the file is moved or renamed the reference will break.

Is there a better way of keeping a reference to a file? It looks like
an NTFS file has an optional "object id" attribute that is used by the
Distributed Link Tracking Service, but I couldn't find any
documentation for using this.

Does anyone have any suggestions?

Thanks in advance,
Epson

Author
1 Sep 2006 7:57 PM
Ben Voigt
<goo***@grider.org> wrote in message
news:1157124017.899472.37760@m79g2000cwm.googlegroups.com...
> My company has a large filesystem that holds hundreds of thousands of
> documents related to the business. Sometimes I have the need to keep
> metadata for some of the documents. This data could be comments, or the
> document's status in a process, etc.


What do you do with the metadata?  If you just want to attach it to the
document, then an NTFS stream is the ticket (already used by MS to store
author, etc for documents and viewable in the file properties dialog).

If you need search, etc., then database is better.  You might look at
updating your paths using the volume journal.
http://www.microsoft.com/msj/0999/journal/journal.aspx

Show quote
>
> The simplest way to do this is to keep the metadata in a database and
> reference the file's full path. The biggest problem with doing it this
> way is if the file is moved or renamed the reference will break.
>
> Is there a better way of keeping a reference to a file? It looks like
> an NTFS file has an optional "object id" attribute that is used by the
> Distributed Link Tracking Service, but I couldn't find any
> documentation for using this.
>
> Does anyone have any suggestions?
>
> Thanks in advance,
> Epson
>
Author
3 Sep 2006 1:02 AM
Mattias Sjögren
>Does anyone have any suggestions?

As long as the file stays on the same volume (but that might be too
big a limitation), you can use the file index as returned by the
GetFileInformationByHandle API.


Mattias

--
Mattias Sjögren [C# MVP]  mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Please reply only to the newsgroup.

AddThis Social Bookmark Button