------------------------ MS-DOS v6.22 Help: ATTRIB -------------------------
<Notes> <Examples>                                                   <Index>
----------------------------------------------------------------------------
 
                                   ATTRIB
 
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
 
Parameter
 
[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.
 
                                      ***

<Syntax> <Examples>
----------------------------------------------------------------------------
 
                               ATTRIB--Notes
 
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.
 
                                      ***

<Syntax> <Notes>
----------------------------------------------------------------------------
 
                              ATTRIB--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
 
                                      ***

----------------------------------------------------------------------------
<Top of page>
Last update: June 14, 2000 06:20 EST by -vjf-
Content © 1997 Microsoft Corporation
All else © 2000 Vernon J Frazee
Counter