Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ attrib(CMD) — OpenDesktop 3.0.0

Media Vault

Software Library

Restoration Projects

Artifacts Sought


 attrib(CMD)                     19 June 1992                     attrib(CMD)


 Name

    attrib - display or change file attributes

 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


 Description

    This command displays, sets, or removes the read-only, archive, system,
    and hidden attributes assigned to files.

 Parameter


    [drive:][path]filename
          Specifies the location and name of the file or set of files 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 subdirec-
          tories.


 Notes


    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.

    Archive attributes

    The archive attribute (a) is used to mark files that have changed since
    they were previously backed up.  The backup, restore, and xcopy commands
    use these archive attributes.  For information about archive attributes,
    see the backup(CMD), restore(CMD), and xcopy(CMD) 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 fol-
    lowing command:

       attrib +r report.txt


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

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


    As a final example, suppose you want to give an associate a disk contain-
    ing 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 use the fol-
    lowing 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


 Related command

    For more information about copying files and directories, see the
    xcopy(CMD) command.


Typewritten Software • bear@typewritten.org • Edmonds, WA 98026