[Tex/LaTex] TeXstudio “creating a backup of the file failed”

texstudio

I am using TeXstudio 2.10.8 to develop LaTeX files. It has not given me any problems so far but today, every time I save the file, I get the following message.

Creating a backup of the file failed.  You can still continue saving.  However, if the save action fails, you may loose the data in the original file.  Do you wish to continue?

I tried restarting the program but still get the message with every save. I also observed that I do not get the problem with a different LaTeX file. I am wondering if it is doing some type of version control and I have filled the buffer. I tried the user manual and it doesn't mention this message. What is the best way to get rid of this message?

I found a file, fileName.tex~txs99, in the directory containing my LaTeX file. I deleted that and no longer get the message. Unfortunately, the file keeps coming back and so does the message.

Best Answer

TeXstudio uses the following saving strategy to prevent data loss if something unforeseen happens during saving:

  1. Prepare: If the file exists, create a backup copy filename.tex~txs[i] so that it's content is not lost in case of error.[i] may be any number between 00 and 99.
  2. Save: Write the original file.
  3. Cleanup: In case of error, rename the backup file back to the original filename, otherwise delete the backup.

You'll get the the error message if TXS is not able to successfully copy the original file to a file with any number [i] between 00 and 99. For example this could happen if you don't have write permissions to the directory.