How to uncheck "read-only" files?

Hello,

How could I do it with a Script in UiPath?

Thanks

@EngAnalyst - can you elaborate your requirement with a simple example. cheers!

image

I need to uncheck the “Read-only” properties of the files.

I checked how to CHECK the read only property but do not know how to uncheck…

  1. How to check the property?

File.SetAttributes(Path, FileAttributes.ReadOnly)

  1. How to uncheck the property?

I do not know :frowning:

GBK

@EngAnalyst - you can try

System.IO.FileInfo fileinfo =new System.IO.FileInfo(“D:\Test.txt”); // use assign activity. 

fileinfo.IsReadOnly= True; // use assign activity

Or

to use the power shall activity and try below script

Set-ItemProperty file.txt -name IsReadOnly -value $false
1 Like

Hello,

I want to uncheck the property not to check it.

@EngAnalyst - Just set it as True/False based on your requirement.

I tried but it does not work… Please, could you share a XAML sample? Thanks in advance

@EngAnalyst - when you follow above steps - file attribute didn’t change?? or facing any issue??

Errors are thrown when i try both options…