Rstudio and Google Drive Syncing Problems: "The process cannot access the file because it is being used by another process"

EDIT: On further use of RStudio my solution didn't solve it - The sync popup just occurs at a lower frequency. The problem is that Google Drive currently doesn't have a feature to ignore Folders just filetypes.

--

This solved it for me:

  1. In Google Drive/Backup and Sync go to Preferences...
  2. Under My Computer click Change:
  3. Under Ignore files with these extensions add .rproj.user

See screenshots below:

Step 1

Step 2

Step 3


I also have been having this problem for a long time. The simplest solution is to quit/turn off GoogleDrive when working in RStudio. You are not going to have ongoing backups but it is not such a huge issue anyway. You can still sync to your drive during the lunch break or after the day. This might solve also the other issues that many people are having. All-in-all GoogleDrive is probably not the best backup solution. I think having the Drive just for e-mails and random shared documents (15-100 Gb) is still a good idea but for serious backing-up (at least 1 Tb) probably DropBox or some other solution is preferable.


I am not sure what caused this error, however I was able to resolve it by following the below steps :

Say you have got a file called temp.R which is giving you the error.

1) Copy all the contents of temp.R and create a new file on your local drive (anywhere outside Google drive) and paste the contents there. Save it with some name say demo.R

2) Now close temp.R from RStudio and move demo.R to google drive folder and now open it via RStudio file explorer.

You can now use demo.R as your new file and start working on it. It will also save all the changes you make henceforth.

So basically, we are just creating a new file and replacing it with the old one.