Uniquely identifying files
| From: | Lawrence dot Sheed at dfait-maeci dot gc dot ca | Date: | Thu, 14 Sep 2000 04:23:56 +0000 |
| Subject: | Uniquely identifying files | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-16688@lists.php.net to get a copy of this message | ||
I have a whole bunch of files I need to track in a database (and create
associated data on).
The filenames will be static (but not necessarily unique), and the contents
of the files are unique, but the problem is that the directories they are in
are not necessarily going to be staticly named.
Originally I was thinking of storing directory/filename into a db and
uniquely identifying by that, but the directory names will be changing.
I was thinking of storing an md5 hash of say the first 2k of every file into
a database, and comparing the hash for a file retrieved with the md5 hashes
in a database and retrieving data associated with it.
My only problem is this is in theory going to be processor intensive.
Has anyone got any other suggestions on how to do this.
I'm kind of adverse to renaming the files uniquely, as the filenames are
meaningful,
My current thoughts are MD5 or CRC32 on the file contents, any ideas would
be appreciated.
Thanks
Lawrence.