B.D
July 15, 2020, 5:17pm
1
Hi everyone,
I’m trying to change the atributes of excel files from “readonly” to “normal” so I can overwrite the files.
So far I got this:
For each file in files
assign: file = File.setatributes(file,FileAtributes.Normal)
(for each loop is set to String)
It says Setatributes is not a member of String.
There was a visual basic rename file method available instead of this you can use “Move Activity” with the same file location but with other name in destination property. It will replace old file.
1 Like
bcorrea
(Bruno Correa)
July 15, 2020, 5:56pm
3
Setattributes is not a function, it wont return file for you…
You can use Invoke Method activity instead.
B.D
July 15, 2020, 5:58pm
4
The thing is the name of the file must be the same. I also don’t understand how the old file can be replaced when the name of the new is diffrent. Lastly, if you use move activity with overwrite enabled it doesn’t overwrite, because the file is set to “read only” and therefore protected.
B.D
July 15, 2020, 6:01pm
5
Hi bcorrea,
how can I do this with invoke method ?
bcorrea
(Bruno Correa)
July 15, 2020, 6:01pm
6
But in your case i dont understand if it is the best way to go…
2 Likes
B.D
July 15, 2020, 6:04pm
7
thank you for your help. this explains a lot.
is the line of code I used correct ?
B.D
July 15, 2020, 6:09pm
9
why is it incorrect ?
if I do it your way it works right ? but I have to replace “c:\myfile.txt” with the “file” variable in this case right ?
balupad14
(Balamurugan)
July 15, 2020, 6:12pm
10
Hi ,
Here is an activity FileReadOnly , It will change the file read only property.
Hi Guys,
I have successfully uploaded a package in UiPath Go.This package contains the below activities .
File Properties [File Read Only, File Securities, Hide Unhide]
The package contains the following 3 activities:
FileReadOnly - Make the file read only
FileSecurities - To add the user with permission to the security
HideUnhide - Hide or Unhide the file
https://go.uipath.com/component/file-property-activities
Regards
Balamurugan.S
Thank you
Balamurugan.S
2 Likes
B.D
July 15, 2020, 6:31pm
11
Hi Balamurugan,
thank you very much! I will look into it.
edit: I just tried the package, works great!
P.S. if anyone knows how to code this right (without using an activity-) please post your solution. I would also like to learn to code this.
bcorrea
(Bruno Correa)
July 15, 2020, 7:24pm
12
yes, ofc you need to point to the file you want to change the attribute for… you dont need to install anything else.
system
(system)
Closed
July 18, 2020, 9:32pm
14
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.