Attributes
dir <path> /a:h /s
Hidden files
dir <path> /a:s /s
System files
dir <path> /a:r /s
Read-only files
dir <path> /a:a /s
Any attribute
Lists files with the specified attributes in the given path:
Get-ChildItem -Path <path> -Attributes <attributes> -Recurse
Get-ChildItem -Path <Path> -File -Recurse | Where-Object { $_.Attributes -match "Attribute" }
Attribute values:
Hidden
System
ReadOnly
Archive
wmic datafile where Attributes='<attributes>' get Name, FileName
Attribute values:
h
(hidden)
s
(system)
r
(read-only)
a
(archive)
Combine attributes using a plus sign (+), e.g., /a:h+s for hidden and system files.
Last updated
Was this helpful?