HTML from RMD run automatically removed

This has been happening for a while. I knit a document to html. The .html file shows up fine. I can open in browser etc...

In 5-90 seconds it disappears. And it is not in trash...
I can remove it from that directory manually (quickly trying before it vanishes) and it doesn't disappear.

This happens on both my Win10 and my Ubuntu 18.04 machines.

Any ideas how I can prevent it from being removed or what is causing it?

More info. This is in a folder that is part of my backup and sync google drive. But gdrive does not do this with anything else.

This definitely has something to do with Google Drive and not specifically R Markdown. I don't really use Google Drive, so I can't give any tips other than to say that you might want to change the title of this post now that you have a better idea of the problem. Somebody here may still be able to help you.

This may be the case, but I'm sorry I'll have to disagree with the definitely part. I use Rmd from Google Drive often (if not always), and never experienced this problem.

That being said, is the problem happening always, even if you pause syncing? Or, does it happen with PDF or WORD outputs?

Thanks @Yarnabrina, I phrased that somewhat poorly. What I meant is that it's very unlikely to be a problem with R Markdown and much more likely to be an issue with syncing via Google Drive.

The R Markdown process won't delete files 5-90 seconds after they're created; once it stops running it will not (can not) change the files. If RMD is the problem, the file will be deleted during or at the end of the rendering process. If there's a delay, then it's not R Markdown.

The issue with files changing spookily is consistent with file-syncing services. Maybe the Windows and Ubuntu machines are fighting with each other? Idk but there certainly are a lot of hits on Google for "Google Drive files disappearing".

Edit: @Yarnabrina's suggestion to try pausing syncing is a great diagnostic test idea.

It does appear that turning off sync before knitting does not result in removed files. Turning back on sync after the fact does not delete the .html. I suspect the issue lies in the temporary files that R is creating and then removing in the folder prior and during creation of the HTML. The .md, and the folder attached to the HTML that are temporary, then removed. I suspect that because the HTML is temporarily linked the FOLDER that houses the embedded objects before finalization, when that folder is removed, Gdrive is also removing the associated HTML before the link is broken.

That is just a hypothesis.

Well, you may try to pause syncing for now before knitting a document, until you get a better solution.

But, I wonder why do you face this, and I (and surely a lot of people) don't face this.

1 Like

@Yarnabrina Me too! It also happens for my undergrad student on a Windows machine. I must also say that I use the client from google that replace "google drive", which is now called "backup and sync". But on unix, I use "insync" that is a 3rd party application that works the same way. Both programs cause the same issue.

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.