Attrib displays, sets, or deletes read-only, archived, system, and hidden properties assigned to a file or directory _dos/bat

Source: Internet
Author: User
Attrib
Displays, sets, or deletes read-only, archived, system, and hidden properties assigned to a file or directory. If used without parameters, attrib displays the properties of all files in the current directory.

Grammar
attrib [{+r|-r}] [{+a|-a}] [{+s|-s}] [{+h|-h}] [[Drive:][path] FileName] [/s[/d]]

Parameters
+r
Sets the read-only property.
-R
Clears the read-only property.
+a
Set archive file properties.
-A
Clears archive file properties.
+s
Set System Properties.
-S
Clears system properties.
+h
Sets the Hidden property.
-H
Clears the hidden attribute.
Drive:}[path] FileName
Specifies the location and name of the directory, file, or filegroup whose properties you want to display or change. You can use wildcard characters in the filename parameter (?). and *) to display or change the properties of a set of files.
/s
Apply attrib and any command-line options to matching files in the current directory and all of its subdirectories.
/d
Apply attrib and any command-line options to the directory.
/?
Display Help at the command prompt.
Comments
Working with Filegroups
You can use wildcard characters in the FileName parameter (?). and *) to display or change the properties of a set of files. If the file has system or hidden properties set, you must first clear its system or hidden properties in order to change other properties of the file.

Using Archive properties
The archive attribute (+a) indicates which files have changed since the most recent backup. The Xcopy command uses the archive attribute. For more information about archive attributes and Xcopy, see.

The Recovery Console provides attrib commands with different parameters.
Example
To display the properties of a file named News86 on the current drive, type:

attrib news86

To assign a read-only property to a file named Report.txt, type:

attrib +r report.txt

For a disk plugged into a B drive, to remove the read-only property of a file in its \Public\Jones directory and any subdirectories of the \Public\Jones directory, type:

Attrib-r B:\public\jones\*.*/S

Consider a scenario where you want to create a connection to a disk in a drive that contains all the files in its default directory (except for files with the. bak extension). Because you can use Xcopy to copy only those files that are marked with the archive attribute, you need to set the archive attribute for the files that you want to copy. You first need to set the archive properties for all the files in drive A. Second, for files with the. bak extension, you want to clear their archive properties. For example, type:

attrib +a a:*.* attrib-a a:*.bak

Next, use the Xcopy command to copy the files from the disk in the A drive to the disk in the B drive. The command line option using/A in the following command causes Xcopy to copy only those files that have the archived attributes marked. For example, type:

xcopy a:b:/a

If you need xcopy to clear the archive attribute for each file after you copy the file, use the/m command-line option instead of/A. For example, type:

xcopy a:b:/m

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.