fortypoundhead.com

ATTRIB.exe

Posted On 2005-11-1 by FortyPoundHead
Keywords:
Tags: Windows Commandline Windows
Views: 2524


Display or change file attributes. Find Filenames.

syntax

ATTRIB [ + attribute | - attribute ] [pathname] [/S]

key

+ : Turn an attribute ON
- : Clear an attribute OFF
pathname : Drive and/or filename e.g. C:\*.txt
/S : Search the pathname including all subfolders.

attributes:

H Hidden
S System
R Read-only
A Archive

If no attributes are specified attrib will return the current attribute settings. Used with just the /S option ATTRIB will quickly search for a particular filename.

Combining the Hidden and System attributes.

If a file has both the Hidden and System attributes set, you can clear both attributes only with a single ATTRIB command.

For example, to clear the Hidden and System attributes for the RECORD.TXT file, you would type:

ATTRIB -S -H RECORD.TXT

Using ATTRIB with groups of files

You can use wildcards (? and *) with the filename parameter to display or change the attributes for a group of files.

Remember that, if a file has the System or Hidden attribute set, you must clear that attribute before you can change any other attributes.

Changing the attributes for a directory

You can display or change the attributes for a directory. To use ATTRIB with a directory, you must explicitly specify the directory name; you cannot use wildcards to work with directories.

For example, to hide the directory C:\SECRET, you would type the following:

ATTRIB +H C:\SECRET

The following command would affect only files, not directories:

ATTRIB +H C:*.*

Viewing archive attributes

The Archive attribute (A) is used to mark files that have changed since they were previously backed up. The (A) flag is automatically updated by Windows as the file is saved.

If the (A) flag is present - the file is new or has been changed since the last backup.

The MSBACKUP, RESTORE, and XCOPY commands use these Archive attributes, as do many (but not all) 3rd party backup solutions.

New attributes in Windows XP

In addition to A,H,R,S, the latest version of NTFS includes the following new attributes

E = Encrypted, C = Compressed, T = Temporary, O = Offline


About the Author

FortyPoundHead has posted a total of 1974 articles.

 


Comments On This Post

No comments on this post yet!


Do you have a thought relating to this post? You can post your comment here. If you have an unrelated question, you can use the Q&A section to ask it.

Or you can drop a note to the administrators if you're not sure where you should post.


Your IP address is:54.161.79.96

Before you can post, you need to prove you are human. If you log in, this test goes away.



Recent Forum Posts

SSL Now Active
dwirch posted on June 16, 2017 at about 8:40 in Site News

SSL Now Active
dwirch posted on June 13, 2017 at about 7:59 in Site News

Coding Archive?
dwirch posted on June 3, 2017 at about 12:54 in Site News

Job Spammer: Bharti Jigyasi
dwirch posted on June 2, 2017 at about 16:57 in Spammers

Coding Archive?
dwirch posted on May 25, 2017 at about 12:38 in Site News

BWASL returns
dwirch posted on May 13, 2017 at about 15:24 in Site News