attr 1.4 has been released
Submitted by ross on Fri, 03/02/2007 - 07:00
DOS's attrib command does not allow you to set the attributes for hidden and system files. Also, it aborts if it encountered an error. So I wrote attr.
You can download the binary here and the source code here. Here's the changelog:attr changelog Version 1.4 - 28 Feb 07: Enabled -n | --not-indexed + | - Set/reset content not indexed bit Enabled -o | --offline + | - Set/reset offline bit Enabled -t | --temporary + | - Set/reset temporary bit Version 1.3 - 14 Nov 06: Added display of attributes in the form 'arhsnot' Added -d | --directories Set/reset bits on directories Added -y | --dry-run Change nothing, just report what would change Added -i | --hide-attributes Do not show attributes Improved error handling Processes *.* if no filespec is specified Return errorcode if an error occured (and --abort-on-error is set) Report on changed files only (unless -v is used) Skipped processing of . and .. directories Version 1.2 - 19 Jul 06: Standardized version information across all programs Version 1.1 - 08 Apr 06: Added -n | --not-indexed + | - Set/reset content not indexed bit Added -o | --offline + | - Set/reset offline bit Added -t | --temporary + | - Set/reset temporary bit Added -e | --abort-on-error Abort if an error occurs Added .rc and .ico files Improved build scripts Updated documentation Version 1.0 - 12 Apr 04: Initial release
and here's the readme.txt:
attr - Version 1.4 - Feb 28 2007 Copyright (c) 2004-2007 Ross Smith II (http://smithii.com) All Rights Reserved ------------------------------------------------------------------------------ Usage: attr [options] filespec [filespec] Options: -a | --archive + | - Set/reset archive bit -r | --readonly + | - Set/reset read only bit -h | --hidden + | - Set/reset hidden bit -s | --system + | - Set/reset system bit -n | --not-indexed + | - Set/reset content not indexed bit -o | --offline + | - Set/reset offline bit -t | --temporary + | - Set/reset temporary bit -d | --directories Set/reset bits on directories -y | --dry-run Change nothing, just report what would change -i | --hide-attributes Do not show attributes -e | --abort-on-error Abort if an error occurs -R | --recursive Scan directories recursively -q | --quiet Display less information -v | --verbose Display more information -V | --version Show version and copyright information and quit -? | --help Show this help message and quit Works on hidden and system files. Doesn't abort on error (unless you use the -e option). When displaying attributes, the following characters are used: Character Meaning --------- ------- - The attribute is not set, and will not be changed _ The attribute was set, and will be reset (turned off) a Archive attribute is set, and will not be changed r Read-only attribute is set, and will not be changed h Hidden attribute is set, and will not be changed s System attribute is set, and will not be changed n Not-indexed attribute is set, and will not be changed o Offline attribute is set, and will not be changed t Temporary attribute is set, and will not be changed A Archive attribute is not set, and will be set R Read-only attribute is not set, and will be set H Hidden attribute is not set, and will be set S System attribute is not set, and will be set N Not-indexed attribute is not set, and will be set O Offline attribute is not set, and will be set T Temporary attribute is not set, and will be set ------------------------------------------------------------------------------ Examples: C:\>rem turn off archive bit on files in c:\ C:\>attr -a- C:\>rem turn off archive bit on files on drive c: C:\>attr -a- -R C:\>rem display what files have their archive bit set on drive c: (but don't change the bit): C:\>attr -a- -R --dry-run *.* C:\>rem display what files don't have their archive bit set on drive c: (but don't change the bit): C:\>attr -a+ -R --dry-run *.* ------------------------------------------------------------------------------ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
»
- ross's blog
- Login or register to post comments

bump. Someone to
bump.
Someone to answer?
Please, could you just tell me, how to proceed when attr.exe is not in the same directory than the files or folders to treat?
Syntax for attr.exe
Hi,
what must be the syntax, if attr.exe is for instance in C:\Download,
and I want to turn off archive bit for all files in folder D:\TEST ?
or maybe I have to copy first attr.exe in D:\TEST
and then run (from DOS) D:\TEST\>attr -a- -R ?
BTW, in your readme.txt, the 3rd example:
C:\>rem Display what files have their archive bit set on drive C: (but don't change the bit):
C:\>attr -a- -R --dry-run *.*
If I have well understood, it could be also: C:\>attr -a- -R -y ?
Thx in advance.
Charles.