title: Get file's permissions for current user .net
body: <p>I'm scanning the folder for files and I need to get each file's permissions for current user in any way to be represented as a string.
  So for the attached file's properties I would like to represent something like <a href="https://i.stack.imgur.com/N417O.jpg" rel="nofollow noreferrer">f-m-r-w</a>
  string.</p>
  
  <p>I'm trying to accomplish this in my scan loop like this, but getting empty strings. Could you hint to where should I go from here or chose another approach? Thanks in advance!</p>
  
  <pre><code>            string permissionShort = string.Empty;
              DirectorySecurity dSecurity = Directory.GetAccessControl(_directory.FullName);
              foreach (FileSystemAccessRule rule in dSecurity.GetAccessRules(true, true, typeof(NTAccount)))
              {
                  if (rule.FileSystemRights == FileSystemRights.Write)
                      permissionShort = permissionShort + "x";
                  if (rule.FileSystemRights == FileSystemRights.Read)
                      permissionShort = permissionShort + "x";
                  if (rule.FileSystemRights == FileSystemRights.AppendData)
                      permissionShort = permissionShort + "x";
                  if (rule.FileSystemRights == FileSystemRights.Modify)
                      permissionShort = permissionShort + "x";
                  if (rule.FileSystemRights == FileSystemRights.ExecuteFile)
                      permissionShort = permissionShort + "x";
              }
  </code></pre>