Meta data of text file

18,513

Solution 1

I can think of lots of metadata that even a plain text file has -- creator, size, permissions, last accessed time, last modified time, etc. -- some of which probably depend on which OS you're talking about. I'd suggest looking at the directory operations and/or the file data structures in the system libraries on the particular OS for a more complete list for each particular OS.

Depending on the usage of the file, it might contain some metadata -- for example, a script file might indicate the program used to run the script at the top -- but in general a plain text file doesn't contain metadata itself.

Solution 2

What file system? Strictly speaking, a "plain text file" doesn't contain any meta data, not even the name of the file. All of that is handled by the file system.

Solution 3

On Linux (not in the file content, but in the filesystem):

  • Permissions
  • Owner
  • Group
  • Size
  • References Count
  • Date of last change
  • Name

There are a few others (like a readonly flag), but you will usually not need them.

Solution 4

Depends what you mean by "meta data". The OS tracks filename, file size, create and modified dates, attributes, etc. for ALL files--not just text files.

But I'm not sure I even consider that meta data. To me I think of a plain text file as not containing any meta data at all.

Share:
18,513
user537488
Author by

user537488

Updated on July 19, 2022

Comments

  • user537488
    user537488 almost 2 years

    besides file name what meta data do a plain text file contain ?

  • Honinbo Shusaku
    Honinbo Shusaku over 7 years
    So then when that file is transferred and opened on another filesystem, how is that information, such as name, transferred?
  • David
    David over 7 years
    @Abdul: As part of the host system's operation for writing the new file. When the target file system receives the command to write the file, part of that command includes the name of the file being written.
  • Honinbo Shusaku
    Honinbo Shusaku over 7 years
    Hm, I guess my confusion resided in the fact that I thought things such as filename, file size (which can be recalculated anyhow), create and modified dates, attributes, and other attributes like that were considered metadata, when other answers on this thread imply that they aren't
  • David
    David over 7 years
    @Abdul: They are metadata. How and where (and if) that metadata is stored depends on the file system. No specific file system was mentioned in the question.
  • Honinbo Shusaku
    Honinbo Shusaku over 7 years
    Understood, so depending on the specific FS, they can be stored and retrieved in and from disk in different, such as file header or a dedicated metadata file.
  • David
    David over 7 years
    @Abdul: Correct. It's possible that some file systems may even store them as "part" of the file itself, separated from the file's contents by some internally defined logic.
  • toraman
    toraman almost 2 years
    Keeping the filename as metadata wouldn't make any sense to me. The file doesn't know if the filename is unique or not. The file system would have to know it as well anyway. Also when the user wants to access the file by name, the fs can't ask each file their names, it has to know.