PowerShell: File Attributes Object Type
Object type of file Attribute
File attribute is of the dotnet type
System.IO.FileAttributes
- Type of File object is
System.IO.FileInfo
- Type of Dir object is
System.IO.DirectoryInfo
- File or Dir object has a property named
Attributes
, and type of its value isSystem.IO.FileAttributes
- The object of type
System.IO.FileAttributes
, has properties namedCompressed
,Hidden
,ReadOnly
,System
, etc., and their type isstatic
# list properties of a file Get-ItemProperty ~\Documents\ | Get-Member -MemberType Properties # TypeName: System.IO.DirectoryInfo # Name MemberType Definition # ---- ---------- ---------- # Target AliasProperty Target = LinkTarget # LinkType CodeProperty System.String LinkType{get=GetLinkType;} # Mode CodeProperty System.String Mode{get=Mode;} # ModeWithoutHardLink CodeProperty System.String ModeWithoutHardLink{get=ModeWithoutHardLink;} # ResolvedTarget CodeProperty System.String ResolvedTarget{get=ResolvedTarget;} # PSChildName NoteProperty string PSChildName=Documents # PSDrive NoteProperty PSDriveInfo PSDrive=C # PSParentPath NoteProperty string PSParentPath=Microsoft.PowerShell.Core\FileSystem::C:\Users\xah # PSPath NoteProperty string PSPath=Microsoft.PowerShell.Core\FileSystem::C:\Users\xah\Documents\ # PSProvider NoteProperty ProviderInfo PSProvider=Microsoft.PowerShell.Core\FileSystem # Attributes Property System.IO.FileAttributes Attributes {get;set;} # CreationTime Property datetime CreationTime {get;set;} # CreationTimeUtc Property datetime CreationTimeUtc {get;set;} # Exists Property bool Exists {get;} # Extension Property string Extension {get;} # FullName Property string FullName {get;} # LastAccessTime Property datetime LastAccessTime {get;set;} # LastAccessTimeUtc Property datetime LastAccessTimeUtc {get;set;} # LastWriteTime Property datetime LastWriteTime {get;set;} # LastWriteTimeUtc Property datetime LastWriteTimeUtc {get;set;} # LinkTarget Property string LinkTarget {get;} # Name Property string Name {get;} # Parent Property System.IO.DirectoryInfo Parent {get;} # Root Property System.IO.DirectoryInfo Root {get;} # UnixFileMode Property System.IO.UnixFileMode UnixFileMode {get;set;} # BaseName ScriptProperty System.Object BaseName {get=$this.Name;}
PowerShell. File Properties, Attributes, Permission
- PowerShell: File Properties
- PowerShell: File Attributes
- PowerShell: List All Possible File Attribute Values
- PowerShell: Show a File's Attributes
- PowerShell: Show Hidden Files
- PowerShell: List Files with Specific Attribute
- PowerShell: Set a File's Attributes
- PowerShell: Set File Read Only Attribute
- PowerShell: File Attributes Object Type
- PowerShell: Change File Owner Perm (ACL)