Clear archive attribute from command line.

by admin on May 3, 2009

We can unset archive attribute of a file using attrib command. Syntax is given below.

attrib -a filename

Example:

attrib -a example.doc

The above command will unset archive attribute for the file example.doc

{ 3 comments… read them below or add one }

Tim Hamilton November 10, 2011 at 4:50 pm

How do I clear the archive bit for all files and folders within a folder and be able to watch the progress?

Reply

admin November 12, 2011 at 5:58 am

Tim, there is no direct command for setting/unsetting attributes for a group of files. Attrib command works on one file at a time. You can use the following batch file command though.

for /F %i in (‘dir /s /b ‘) do attrib -A %i
This command will unset archive attributes for all the files in the current directory and in the subdirectories.

To do this for a directory the command would be:
for /F %i in (‘dir /s /b directory_path ‘) do attrib -A %i

admin January 4, 2012 at 5:32 pm

attrib command does not show any progrss. However, you can create your own batch script that prints the status and invokes attrib command on one file at a time.

Leave a Comment

Previous post:

Next post: