A link to a reference... Microsoft on the Windows attrib command.
The description of the /d
option... "Applies attrib and any command-line options to directories."
attrib
used without a path prints attributes for files only in the current directory. When attrib
is used without a path the /d
option seems to mean "do it for directories in addition to files" and that is not the understanding I would receive from the description of /d
so I'm not sure if the description is lacking or if somehow this is supposed to be obvious. I know files and directories are distinct in Windows (but in Linux directories are a subclass of the class of files).
From testing with the read-only attribute +r
/ -r
are some of my observations...
attrib prints attributes for files in the current directoryattrib /d prints attributes for files and directories in the current directoryattrib +r /s /d dir sets the attributes for the directory not recursivelyattrib +r /s /d dir\* sets the attributes for files and directories recursivelyattrib +r /s /d * sets attribs for files and dirs in current dir and recursively
The description of the /s
option... "Applies attrib and any command-line options to matching files in the current directory and all of its subdirectories." Since recursion is not mentioned perhaps the expectation should have been that the 3rd, 4th, and 5th commands should not have recursed, but in testing we can demonstrate that recursion is possible. There is a documentation problem... operating on "all of its subdirectories" is not the same as recursion which is understood to mean all levels of subdirectories.
Why is the third example not already recursive? To my eye the 3rd example is a subset of the 5th example.