Sideway
output.to from Sideway
Draft for Information Only

Content

MS DOS Command: ATTRIB
  Description
  Syntax
  Parameters
  Switches
  Related Command
  Remarks
   Combining the Hidden and System attributes
   Using ATTRIB with groups of files
   Changing the attributes for a directory
   Viewing archive attributes
  Examples

MS DOS Command: ATTRIB

Reference from Microsoft MS-DOS cmd help

Description

Displays or changes file attributes.

This command displays, sets, or removes the Read-Only, Archive, System, and Hidden attributes assigned to files or directories.

Syntax

ATTRIB [+R|-R] [+A|-A] [+S|-S] [+H|-H][[drive:][path]filename] [/S]

To display all attributes of all files in the current directory, use the following syntax:

ATTRIB

Parameters

[drive:][path]filename Specifies the location and name of the file(s) you want to process.

Switches

+R Sets the Read-Only file attribute.
-R Clears the Read-Only file attribute.
+A Sets the Archive file attribute.
-A Clears the Archive file attribute.
+S Sets the file as a System file.
-S Clears the System file attribute.
+H Sets the file as a Hidden file.
-H Clears the Hidden file attribute.
/S Processes files in the current directory and all of its subdirectories.

Related Command

For more information about copying files and directories with different attributes, see the XCOPY command.

Remarks

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. If a file has the System or Hidden attribute set, you must clear that attribute before you can change any other attributes for that file.

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 MSBACKUP, RESTORE, and XCOPY commands use these Archive attributes. For information about Archive attributes, see the MSBACKUP, RESTORE, and XCOPY commands.

Examples

To display the attributes of a file named NEWS86 located on the current drive, type the following command:

attrib news86

To assign the Read-Only attribute to the file REPORT.TXT, type the following command:

attrib +r report.txt

To remove the Read-Only attribute from files in the \PUBLIC\JONES directory on a disk in drive B and from files in any subdirectories of \PUBLIC\JONES, type the following command:

attrib -r b:\public\jones\*.* /s

As a final example, suppose you want to give an associate a disk containing all files in the default directory on a disk in drive A except files with the .BAK extension. Because you can use XCOPY to copy only those files marked with the Archive attribute, you need to set the Archive attribute for those files you want to copy. To do this, you would use the following two commands to set the Archive attribute for all files on drive A and then to clear the attribute for those files with the .BAK extension:

attrib +a a:*.*

attrib -a a:*.bak

Next, use the XCOPY command to copy the files from the disk in drive A to the disk in drive B. The /A switch in the following command causes XCOPY to copy only those files marked with the Archive attribute:

xcopy a: b: /a

If you want XCOPY to clear each file's Archive attribute after it copies the file, use the /M switch instead of /A, as in the following example:

xcopy a: b: /m


©sideway

ID: 110700130 Last Updated: 7/21/2011 Revision: 0


Latest Updated LinksValid XHTML 1.0 Transitional Valid CSS!Nu Html Checker Firefox53 Chromena IExplorerna
IMAGE

Home 5

Business

Management

HBR 3

Information

Recreation

Hobbies 8

Culture

Chinese 1097

English 339

Travel 18

Reference 79

Computer

Hardware 254

Software

Application 213

Digitization 37

Latex 52

Manim 205

KB 1

Numeric 19

Programming

Web 289

Unicode 504

HTML 66

CSS 65

SVG 46

ASP.NET 270

OS 431

DeskTop 7

Python 72

Knowledge

Mathematics

Formulas 8

Set 1

Logic 1

Algebra 84

Number Theory 206

Trigonometry 31

Geometry 34

Coordinate Geometry 2

Calculus 67

Complex Analysis 21

Engineering

Tables 8

Mechanical

Mechanics 1

Rigid Bodies

Statics 92

Dynamics 37

Fluid 5

Fluid Kinematics 5

Control

Process Control 1

Acoustics 19

FiniteElement 2

Natural Sciences

Matter 1

Electric 27

Biology 1

Geography 1


Copyright © 2000-2025 Sideway . All rights reserved Disclaimers last modified on 06 September 2019