B4J Question B4J - SetReadOnly folder and file.

T201016

Active Member
Licensed User
Longtime User
Sub SetReadOnly(ApplyFolder As String, ApplyFileName As String) 'ignore
Dim r As Reflector
r.Target = r.CreateObject2("java.io.File", Array As String(ApplyFolder, ApplyFileName), Array As String("java.lang.String", "java.lang.String"))
r.RunMethod("setReadOnly")
End Sub
I have a question, why in the above example the function (is ignored) doesn't work? I'm looking for a way to set the Read-Only attribute for a folders and a files. Any ideas, an example is also welcome.

Thanks.
 
Solution
In your previous question you asked about the hidden attribute...
Hidden attribute

Open up a command prompt and you will see that you can set the Read-only attribute in the same way as the hidden attribute.
Wow! Super! @PaulMeuris
Just what I was looking for - thanks a lot .

Initially, in my tests, I had the Hiden attribute set on the objects on which I was going to set READ-ONLY and it didn't work out, so I decided that I must be wrong in naming the attributes.
But already tamed šŸ˜‰

My Library: B4XAttribute

PaulMeuris

Active Member
Licensed User
In your previous question you asked about the hidden attribute...
Hidden attribute
E:\>attrib /?
Displays or changes file attributes.
ATTRIB [+R | -R] [+A | -A ] [+S | -S] [+H | -H] [+I | -I]
[drive:][path][filename] [/S [/D] [/L]]

+ Sets an attribute.
- Clears an attribute.
R Read-only file attribute.
A Archive file attribute.
S System file attribute.
H Hidden file attribute.
I Not content indexed file attribute.
X No scrub file attribute.
V Integrity 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.
/L Work on the attributes of the Symbolic Link versus
the target of the Symbolic Link
Open up a command prompt and you will see that you can set the Read-only attribute in the same way as the hidden attribute.
 
Upvote 0

T201016

Active Member
Licensed User
Longtime User
In your previous question you asked about the hidden attribute...
Hidden attribute

Open up a command prompt and you will see that you can set the Read-only attribute in the same way as the hidden attribute.
Wow! Super! @PaulMeuris
Just what I was looking for - thanks a lot .

Initially, in my tests, I had the Hiden attribute set on the objects on which I was going to set READ-ONLY and it didn't work out, so I decided that I must be wrong in naming the attributes.
But already tamed šŸ˜‰

My Library: B4XAttribute
 
Last edited:
Upvote 0
Solution
Top