1

I am writing some Excel files on a file server at:

\\doc\Home\RC\file.xlsx

using write_xlsx

write_xlsx(data, \\doc\Home\RC\file.xlsx))

The issue is that some people forget to close the files at end of the day so when I try to update these files daily, R scripts fails to overwrite the files because some one has already opened it.

Is it possible to make these files read only for all other users?

So that they can only read, open, copy it. But that does not interfere with me overwriting them?

But not write on it.

mike
  • 49
  • 4
  • Have you tried the `Sys.chmod` commands such as: `Sys.chmod(file, "640", use_umask = FALSE)`. This may be a duplicate or closely related to: https://stackoverflow.com/questions/22025026/how-to-change-file-permission-for-all-users-in-r – al-obrien Dec 03 '19 at 03:53
  • done, thanks. helped. – mike Dec 03 '19 at 06:31
  • I have converted it to a solution if you would like to accept. Thanks! – al-obrien Dec 03 '19 at 16:28

1 Answers1

1

Please try Sys.chmod commands such as Sys.chmod(file, "640", use_umask = FALSE), as you can see similarly done at: How to change file permission for all users in R

al-obrien
  • 1,353
  • 11
  • 29