
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Retrieve Files and Folders Attributes Using PowerShell
To retrieve files and folders attributes using PowerShell, you can use Get-Item or Get-ChildItem command. For example, We have a file called testfile.txt to get its attributes,
PS C:\> Get-ChildItem C:\Temp\TestFile.txt |Select Name,Attributes Name Attributes ---- ---------- TestFile.txt Archive
So this file has the Archive attribute. To retrieve multiple files and folders' attributes, just refer to the folder name instead of the file name.
Get-ChildItem C:\Temp -Recurse -Force | Select Name, FullName, Attributes Name Attributes ---- ---------- TestFile.txt Archive
-Force parameter will retrieve all the files and folders including Hidden and read-only.
The above same thing can be achieved with the Get-Item command.
Get-Item C:\Temp\TestFile.txt |Select Name,Attributes
Advertisements