JSI Tip 7880. How do I reverse the setting of a file's archive attribute?

I have scripted RevArcAttrib.bat to flip the setting of a file's archive attribute bit.

The syntax for using RevArcAttrib.bat is:

RevArcAttrib FullyQualifiedFileName

Where FullyQualifiedFileName is the fully qualified file name of the file whose archive attribute you wish to reverse.

RevArcAttrib.bat contains:

@echo off
if \{%1\}==\{\} @echo Syntax: RevArcAttrib FullyQualifiedFileName&exit /b 1
if not exist %1 @echo RevArcAttrib: %1 was NOT found&exit /b 2
set file=%1
call :silent 
exit /b 0
for /f "Tokens=*" %%a in ('dir %file% /b /aa') do attrib -a %file%&goto :EOF
for /f "Tokens=*" %%a in ('dir %file% /b /a-a') do attrib +a %file%

Hide comments


  • Allowed HTML tags: <em> <strong> <blockquote> <br> <p>

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.