Hello, could you please tell me how to delete a file which has attribute Read-only set as True? I can delete this file manually without problems but the activity “Delete file” always throws UnauthorizedAccessException. Is there some workaround how to delete such file or how to modify file’s attribute?
Only way i found is to use “Invoke Power Shell” activity with following command (IsScript must be checked):
“Set-ItemProperty ‘full file name’ -name:IsReadOnly -value:0”+ vbCrLF +
“Remove-Item ‘full file name’”
To delete entire folder all files’ attributes must be changed prior the deletion and then this command can be used:
“Remove-Item -path ‘folder path’ -recurse -confirm:0”
1 Like
Alternatively, you can use the InvokeMethod activity before the Delete to clear the read only flag by calling the SetAttributes static method of the System.IO.File type.
9 Likes
thanks Mihai, this helps
Guys where are deleted files removed by Delete activity ? Is there any way to undo it ? I deleted all my my desktop files