[Mono-list] How to get file information on Linux?

David Schmitt david at dasz.at
Mon Mar 3 21:18:30 UTC 2014


On 2014-03-03 15:08, cocowalla wrote:
> I want to get various bits of information about files on Linux systems.
>
> In particular, I want to get file attributes, file permissions, owner and
> whether the file is an actual file or a link of some type.
>
> In Windows I would use FileInfo.Attributes to get file attributes - but this
> just returns FileAttributes.Normal on Linux, even though the lsattr command
> reports ----ia-------e-- (for example).
>
> In Windows I would use FileSecurity to get the owner and file permissions -
> but this throws with PlatformNotSupportedException on Linux.

Take a look at the Mono.Posix assembly, specifically 
Mono.Unix.FileAccessPermissions.


Regards, David



More information about the Mono-list mailing list