views:

652

answers:

4

I'm searching for a good way to add meta data to a file. dsofile.dll works fine for NTFS. The meta data is lost, when one drops a copy on a FAT32 share (it uses NTFS hidden streams I guess). Microsoft Word documents contain meta data that are not lost, how do they do it? Similiar to FAT, sending the file via E-Mail strips of all meta data created with dsofile (and also meta data created by hand with Windows Explorer). Separate meta data files are not an option. It must be compatible with standard Windows techniques. If I send someone a file with Outlook and he sends it back, the meta-data should not be lost.

(the required meta data is actually only an ID)

A: 

I've got the same Problem! Has anyone a solution for this kind of problem?

I already thought of writing some Information right behind the EOF (End of File) character. Is this possible without ruining the integrity of the file?

Chris

YMMV. The "End of File" character is a holdover from when file sizes were rounded up to a sector size. Today, they are byte granular and many applications rely upon file size being accurate. Worse, for files that do not contain textual data (like databases), this character may occur naturally and NOT be "end of file".
MJZ
A: 

What about the standard properties rather than custom DSOFile properties? Ie Comments, Author etc? do they get wiped?

Not sure if its ideal but a way we've gotten around it is that we have a tool that will take the DSOfile properties and save a text file, which is then emailed along with the file, and at the other end the user runs a tool to re-import the dsofile properties from the text.

RodH257
+1  A: 

The issue is that all file systems provide a single-stream view of the file as a greatest-common-denominator. Through this interface which exposes the files "contents", you can read or store properties and have them be transported with the "contents" by naive system (or user-) utilities. For example, CopyFile in Windows will carefully lose alternate data streams and has no notion of "shadow files".

The question is whether or not the format of the "contents" allows for arbitrary addition of properties.

Some formats allow arbitrary content (e.g., MSFT's docfile aka .doc/.xls/etc). Some allow limited content (.mp3, .jpg, .exe).

Some are completely SOL (.txt, .bmp).

MJZ
A: 

Any solution would be format-dependent. MS OFfice files are (all) compound files and there's a place for properties there. In some formats (PE files, for example) it's safe to just append data to the end of the file, if you know how to read them later. In ZIP file you can probably find a place in the directory or just add a helper file with your data to the archive. Other formats can't stand this, and you'd need to find your own way at solving the problem.

Actually, file name can also be a good placeholder for your ID.

If you need to store the files somewhere but don't need the file to remain readable by outside applications, you can pack them to ZIP archive or use something like our SolFS library.

Eugene Mayevski 'EldoS Corp
Right, in the zip format, there is currently no formalized mechanism for storing the NTFS metadata from "hidden data streams" into the zip entry. Normally this NTFS metadata is not stored at all in the zip.
Cheeso