You are not logged in.

#1 2008-09-26 13:02:41

dav7
Member
From: Australia
Registered: 2008-02-08
Posts: 674

File comments

For a long time, I've known that UNIX has support for some kind of comment field in its filesystems, and every now and then I get a little confirmation from things like eg a webserver that has an additional "comment" field running alongside the listing (no, that support isn't via a .comments file or something else, I'm pretty sure it really was reading some kind of block from the file descriptor), or some other similar thing. Does Linux have this, and if it does, how do I use it?

If it's filesystem-dependant, I use JFS.

If I'm completely wrong about this comment thing (and I'll be really surprised if I am), what method do you recommend so that I can add comments to files myself? Or what else do you recommend I take a look at for sorting out/organizing a file system via a method similar to using comments or tags?

-dav7

Last edited by dav7 (2008-09-27 12:51:35)


Windows was made for looking at success from a distance through a wall of oversimplicity. Linux removes the wall, so you can just walk up to success and make it your own.
--
Reinventing the wheel is fun. You get to redefine pi.

Offline

#2 2008-09-26 14:22:01

Bralkein
Member
Registered: 2004-10-26
Posts: 354

Re: File comments

Well I didn't know anything about this until today, but your comment intrigued me so I decided to check it out. Linux does indeed support something like the feature you mention, called extended file attributes or xattrs for short. JFS supports these, in fact I use JFS myself so I can confirm first hand that they work. You can assign key-value pairs to a file, then retrieve them later. The key must be set in one of the supported namespaces: "security", "system", "trusted" or "user". You also need to install the "attr" package to be able to work with them (this was already installed on my machine, so...). Here is an example:

[jack@Jackington ~]$ setfattr -n user.author -v "John Smith" drawing.png
[jack@Jackington ~]$ getfattr -d drawing.png
# file: drawing.png
user.author="John Smith"

I think there are easier ways to tag files though, I am using KDE and the Dolphin file manager lets you assign searchable comments and tags to anything you like. However, they are not implemented using the xattr system, so maybe you don't want to use that. There might be another file manager that can do this with xattrs, but you'll have to ask someone better informed, I'm afraid!

Offline

#3 2008-09-27 04:59:30

dav7
Member
From: Australia
Registered: 2008-02-08
Posts: 674

Re: File comments

Wow, cool big_smile

I can use "user.tags" and stuff big_smile

Thanks a heap for this info!

-dav7


Windows was made for looking at success from a distance through a wall of oversimplicity. Linux removes the wall, so you can just walk up to success and make it your own.
--
Reinventing the wheel is fun. You get to redefine pi.

Offline

#4 2008-09-27 05:06:58

Allan
Pacman
From: Brisbane, AU
Registered: 2007-06-09
Posts: 11,357
Website

Re: File comments

I don't think this is sticky material.  Make a wiki page if you like.

Offline

#5 2008-09-27 12:52:07

dav7
Member
From: Australia
Registered: 2008-02-08
Posts: 674

Re: File comments

Allan: okay, I might (or might not...) do a Wiki page then.

-dav7


Windows was made for looking at success from a distance through a wall of oversimplicity. Linux removes the wall, so you can just walk up to success and make it your own.
--
Reinventing the wheel is fun. You get to redefine pi.

Offline

Board footer

Powered by FluxBB