- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How to 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
- Related Articles
- How to change files and folders attributes using PowerShell?
- How to get hidden files and folders using PowerShell?
- How to delete empty files and folders using PowerShell?
- How to delete hidden files and folders using PowerShell?
- How to display files/folders including hidden files/folders in PowerShell?
- How to Zip / Unzip files or folders using PowerShell?
- How to get only hidden files and folders in PowerShell?
- How to copy readonly and hidden files/folders in the PowerShell?
- How to get only files but not the folders with Get-ChildItem using PowerShell?
- How to remove hidden files and folders using Python?
- How to copy files/folders to the remote location in the PowerShell?
- How to retrieve Azure VMs using PowerShell?
- How to retrieve certificate thumbprint using PowerShell?
- How to retrieve a specific number of lines from files in PowerShell?
- How to get the list of shared folders using PowerShell?

Advertisements