How to get file permissions that are associated with a file?
This is what I have:
Code:
using System;
using System.IO;
using System.Text;
namespace File_Permissions
{
class Start {
static void Main(string[] args)
{
string dir = "dummy";
string dir_fil = "dummy/test.txt";
FileAttributes attributes = File.GetAttributes(dir);
System.Console.WriteLine(" These are the directory 'dummy' attributes : " + attributes.);
}
}
}
What I'm trying to do is get the attributes of a file/directory that you normally would see when you try to view the "Properties" on a file. I've found these examples, but it's kind of lacking:
https://www.tutorialspoint.com/file-...sions-in-chash
What's the best way to view _all_ of these properties? Specifically, I'd like to know how to view permissions, owner, etc. and then print all of this out to the console.
Re: How to get file permissions that are associated with a file?
Re: How to get file permissions that are associated with a file?
Do you mean file permissions or file attributes? These are quite different.
Re: How to get file permissions that are associated with a file?
Re: How to get file permissions that are associated with a file?
Quote:
Originally Posted by
2kaud
Do you mean file permissions or file attributes? These are quite different.
Is there a way to do both of them? Are there "file.printAllPermissions();" and "file.printAllAttributes();"? Or would I need to make that function myself?
Re: How to get file permissions that are associated with a file?
I guess you have to implement it yourself. Just see the examples and documentation and repeat output for each attribute you want to.