Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Windows cli equivalent of Mac `xattr`?

I thought extended file attributes existed in NTFS which Windows supports. I cannot find a cmd for accessing/updating attributes.

Is there a flavor of Windows (and its file system) that supports this?

I tried getfattr, setfattr, and a number of other commands. attrib is not it either.

If extended attributes are to remain portable across filesystems (even virtual ones implemented in FUSE) then all target platforms need to present an api in userspace (a cmd or set of cmds).

like image 521
Mario Avatar asked Sep 27 '17 22:09

Mario


1 Answers

The closest thing to UNIX attribs are EAs: NTFS stores partition metadata called Extended Attributes (EA), which allow data to be stored as an attribute of a file or folder.

EAs, for instance, are used by IE to identify a file as having been "downloaded from the web".

From Wikipedia:

On Windows NT, limited-length extended attributes are supported by FAT, HPFS, and NTFS. This was implemented as part of the OS/2 subsystem. They are notably used by the NFS server of the Interix POSIX subsystem in order to implement Unix-like permissions. The Windows Subsystem for Linux added in the Windows 10 Anniversary Update uses them for similar purposes, storing the Linux file mode, owner, device ID (if applicable), and file times in the extended attributes. Additionally, NTFS can store infinite-length extended attributes in the form of alternate data streams (ADS), a type of resource fork. Plugins for the file manager Total Commander, like NTFS Descriptions and QuickSearch eXtended support filtering the file list by or searching for metadata contained in ADS Streams. Ref.

If you want to do something security related you want to take a look at the Discretionary Access Control List (DACL) functionality; http://www.windowsecurity.com/articles/Understanding-Windows-NTFS-Permissions.html

Powershell can help setting the mode and extended file and folder attributes - but this does, unfortunately, only apply to regular attributes (not EAs).

I found something related to NTFS attribs in the 3G-Fuse source that might be helpful. However, I doubt that's truly portable.

like image 177
wp78de Avatar answered Nov 15 '22 09:11

wp78de