Search code examples
command-linebatch-filedos

Change attributes of a group of files in MS-DOS


The MS-DOS command attrib changes the attributes of a single file. How can I use it to change the attributes of a group of files?


Solution

  • This is the info you need

    Displays or changes file attributes.
    
    ATTRIB [+R | -R] [+A | -A ] [+S | -S] [+H | -H] [drive:][path][filename]
           [/S [/D]]
    
      +   Sets an attribute.
      -   Clears an attribute.
      R   Read-only file attribute.
      A   Archive file attribute.
      S   System file attribute.
      H   Hidden file attribute.
      [drive:][path][filename]
          Specifies a file or files for attrib to process.
      /S  Processes matching files in the current folder
          and all subfolders.
      /D  Processes folders as well.
    

    By using the '/s' parameter will do it for matching files for example

    attrib -rhsa *.txt /s
    

    That will remove the read, hidden, system and archive attributes from ALL files ending with '.txt'.