Viewing and setting file attributes on NTFS

Posted: (EET/GMT+2)

 

The NTFS (NT File System) file system allows you to configure and use file attributes. These can be managed easily using the attrib command. If you need to view or change file attributes on an NTFS volume, you can do it quickly from the command line.

Running:

attrib

...in a directory will list all files with their current attributes. The flags are:

R  Read-only
H  Hidden
S  System
A  Archive

To set or clear attributes, use + or - with the attribute letter. For example:

attrib +r file.txt
attrib +h secret.txt
attrib -a backup.log

You can also apply changes recursively:

attrib +h /s *.log

That marks all .log files in the current directory and subdirectories as hidden.

Handy when preparing files for backup or hiding configuration files from normal directory listings.