COPYing attributes

  • This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

rconn

Administrator
Staff member
May 14, 2008
10,101
85
#2
> It appears that the Hidden attribute of directories copied using COPY
> /H is not copied. The H attribute of files is properly copied.
WAD.

There was a lot of discussion about this 15+ years ago, and it was
eventually decided that not copying the attribute bits for directories made
the most sense in most cases. (Which would seem to be corroborated by your
experience, since you only just now discovered this after many years of
use!)

Rex Conn
JP Software
 
#3
---Quote---
|| It appears that the Hidden attribute of directories copied using COPY
|| /H is not copied. The H attribute of files is properly copied.
| ---End Quote---
| WAD.
|
| There was a lot of discussion about this 15+ years ago, and it was
| eventually decided that not copying the attribute bits for directories
made
| the most sense in most cases. (Which would seem to be corroborated by
your
| experience, since you only just now discovered this after many years of
| use!)

No, I just don't often copy full trees which include hidden
directories, and I always attributed the issue to cockpit error, not
to a design feature in conflict with documentation:

"/K (Keep read-only attribute) To maintain compatibility with CMD.EXE,
COPY normally maintains the hidden and system attributes, sets the
archive attribute, and removes the read-only attribute on the target
file. /K tells COPY to also maintain the read-only attribute on the
destination file...."

There is no mention that the phrase relating to hidden and system
attributes applies only to files, not directories!

In any event, I now suggest adding a suboption either to the /H
or the /K option to copy the hidden and system attributes of
directories as well as files.
--
Steve
 

rconn

Administrator
Staff member
May 14, 2008
10,101
85
#4
> "/K (Keep read-only attribute) To maintain compatibility with CMD.EXE,
> COPY normally maintains the hidden and system attributes, sets the
> archive attribute, and removes the read-only attribute on the
> target
> file. /K tells COPY to also maintain the read-only attribute on the
> destination file...."
>
> There is no mention that the phrase relating to hidden and system
> attributes applies only to files, not directories!
I think that "on the target file" clearly indicates that it's referring to
files, not directories. And since CMD doesn't copy directories, the phrase
could only apply to files.


> In any event, I now suggest adding a suboption either to the /H
> or the /K option to copy the hidden and system attributes of
> directories as well as files.
COPY isn't a very good choice if what you want to do is duplicate a file
system.

Rex Conn
JP Software