barrytraver
Programmer
"How can I turn off the read-only attribute?" is actually the shortened version of my question.
The longer version is "How can I turn off the read-only attribute of all of the files in a user-selected directory _and_ in all of its subdirectories?"
Letting the user select a directory and turning off the read-only attribute of a particular file are the easy parts. The hard part is turning off the read-only attribute not only of all of the files in the user-selected directory but also of all of the files in its subdirectories. Is there any relatively straightforward way to do this?
I've tried to do it using repeated calls to Dir, but that gets rather confusing (in my case, impossibly confusing?) when I try to handle the subdirectories (not knowing in advance how many there are or how many levels of subdirectories there are). I further suspect that using recursiion may be the only way to go in this situation, but that's not an aspect of programming with which I've had much experience.
Here's the background for this question, if you're curious. If entire directories (and their subdirectories) are copied from a CD-ROM to a hard drive, all of the files are set as read-only. What I want to be able to do is in a VB program to turn off the file read-only attributes.
Thanks in advance for any suggestions.
Barry Traver
P.S. My guess is that a solution to this problem could be tremendously useful in many other situations (e.g., producing a catalog of a directory and all of its subdirectories).
The longer version is "How can I turn off the read-only attribute of all of the files in a user-selected directory _and_ in all of its subdirectories?"
Letting the user select a directory and turning off the read-only attribute of a particular file are the easy parts. The hard part is turning off the read-only attribute not only of all of the files in the user-selected directory but also of all of the files in its subdirectories. Is there any relatively straightforward way to do this?
I've tried to do it using repeated calls to Dir, but that gets rather confusing (in my case, impossibly confusing?) when I try to handle the subdirectories (not knowing in advance how many there are or how many levels of subdirectories there are). I further suspect that using recursiion may be the only way to go in this situation, but that's not an aspect of programming with which I've had much experience.
Here's the background for this question, if you're curious. If entire directories (and their subdirectories) are copied from a CD-ROM to a hard drive, all of the files are set as read-only. What I want to be able to do is in a VB program to turn off the file read-only attributes.
Thanks in advance for any suggestions.
Barry Traver
P.S. My guess is that a solution to this problem could be tremendously useful in many other situations (e.g., producing a catalog of a directory and all of its subdirectories).