非NTFS权限,在FAT32下也可用的,
也不是改文件的普通属性,
是怎么弄的??

解决方案 »

  1.   

    好像用System.IO.FileAttribute
    更改里头的属性就可以,具体可以参考msdn
      

  2.   

    System.IO.File.SetAttributes(,,,)public static void SetAttributes(string path,FileAttributes fileAttributes); 下面的代码可以设置文件c:\tempuploads\newFile.txt的属性为只读、隐藏。 private void SetFile() 
    {   File.SetAttributes(@"c:\tempuploads\newFile.txt",  FileAttributes.ReadOnly FileAttributes.Hidden); } 
      

  3.   

    FileAttributes.ReadOnly相当于System.IO.FileAttributes.ReadOnly.
    命名空间:System.IO
      

  4.   

    每个文件都有自己的权限,DOS下打印attrib这个命令的帮助就知道了。
      

  5.   

    File.SetAttributes 方法
    path 
    该文件的路径。 
    fileAttributes 
    所需的 FileAttributes,例如 Hidden、ReadOnly、Normal 和 Archive-------------------------------------------------
    下面的示例通过将 Archive 和 Hidden 属性应用于文件,演示了 GetAttributes 和 SetAttributes 方法。
    [Visual Basic] 
    Imports System
    Imports System.IO
    Imports System.TextPublic Class Test
        Public Shared Sub Main()
            Dim path As String = "c:\temp\MyTest.txt"        ' Delete the file if it exists.
            If File.Exists(path) = False Then
                File.Create(path)
            End If        If (File.GetAttributes(path) And FileAttributes.Hidden) = FileAttributes.Hidden Then
                ' Show the file.
                File.SetAttributes(path, FileAttributes.Archive)
                Console.WriteLine("The {0} file is no longer hidden.", path)        Else
                ' Hide the file.
                File.SetAttributes(path, File.GetAttributes(path) Or FileAttributes.Hidden)
                Console.WriteLine("The {0} file is now hidden.", path)
            End If
        End Sub
    End Class
    [C#] 
    using System;
    using System.IO;
    using System.Text;class Test 
    {
        public static void Main() 
        {
            string path = @"c:\temp\MyTest.txt";        // Delete the file if it exists.
            if (!File.Exists(path)) 
            {
                File.Create(path);
            }        if ((File.GetAttributes(path) & FileAttributes.Hidden) == FileAttributes.Hidden) 
            {
                // Show the file.
                File.SetAttributes(path, FileAttributes.Archive);
                Console.WriteLine("The {0} file is no longer hidden.", path);        } 
            else 
            {
                // Hide the file.
                File.SetAttributes(path, File.GetAttributes(path) | FileAttributes.Hidden);
                Console.WriteLine("The {0} file is now hidden.", path);
            }
        }
    }
      

  6.   

    FileAttributes的readonly还是可以删掉的,
    hidden还是可以用显示所有文件时看到的