Restoring Backups

yWriter has a comprehensive backup system, but when things go wrong it's handy to have step by step instructions for recovering your data.

Important: If your project files don't have .yw5 extensions, you need to change the Windows folder settings to enable this option: Display File Extensions

First, a couple of DO NOTS:

I. If you open a project and find that it's become corrupted, close yWriter and DO NOT try opening the project again until you go through the steps below!

II. If you have a corrupted project, DO NOT try to open one of the .yw5 backup files in the backup directories. It won't work, and it will complicate your recovery.

Automatic restore, version 5.1.2.7 and later:

Use the option Tools - Backups - Restore Autobackup. Just select your last known good full backup from the list, tell it the folder to restore to (NOT a folder that already contains a yWriter project!), and it will restore a working copy of your project.

NOTE: You can also use this to create a clean copy of your project without all the old backups.

Sometimes, though, you may be able to recover a corrupted project without going back to an old backup. Here are the steps to try.

Manual troubleshooting and restore:

1) Close yWriter.

2) Find and make a safe copy of your log.txt file so that you can send it to Simon if he needs it. On a Windows XP system, it will be in (drive letter):\Documents and Settings\(your user name)\Application Data\Spacejock Software\yWriter5. On Vista or Win 7, it will be in (drive letter):\Users\(your user name)\AppData\Roaming\Spacejock Software\yWriter5.

You may want to look at it in a text editor to see if you see an obvious reason for your project file becoming corrupted. (For example, if someone accidentally deleted or renamed your RTF5 folder in your project, it will recreate the folder with nothing in it, and there would probably be a log entry for that.) Note that you can display it from yWriter option Tools - Debug - View Log, if you have yWriter set so it doesn't reopen your corrupted project.

3) Before doing anything else, make a safe copy of your project folder and all of its contents. You don't want to make any changes to the copy, just keep it so you have something you can copy back in and start over with if your first recovery attempt is unsuccessful.

4) Open your project folder and see what's in it. There should be 5 folders and 2 files.

The folders are Autobackups, Export, Images, Logs, and RTF5. The files should be (your project name).yw5 and (your project name).yw5.bak.

If there's a .lock file, it means that yWriter either has the project open or that it crashed while the project was open. In a recovery situation with yWriter shut down, it shouldn't be there. Make absolutely certain that yWriter isn't running (check for the yWriter5.exe task in Task Manager if necessary), and then delete the file. If you have a missing or incorrectly named folder, you can correct the problem. Make sure you understand why the corruption happened before you open the project in yWriter, so that you don't just recreate the problem.

5) If there's nothing obviously wrong in the project structure, compare your .yw5 to your .yw5.bak file. The .bak is a copy of the .yw5 from before the last time you opened it. If you've only opened your project once (see DO NOT #1), the .bak may be good, if your project became corrupt when you opened it. Often when a project becomes corrupted, you'll see a .yw5 file that's 2 KB in size (like a new, empty project) and a .bak file that still contains all your project data from before the corruption. If that's the case, you can recover the project simply by renaming, moving, or deleting the corrupt .yw5 file and replacing it with a copy of the good .bak file. Before you open it, you still need to determine why yWriter corrupted it (for example, the 5.1.2.2 beta that created an incompatibility in any .yw5 files it saved), but at least you have your project back.

6) If the .bak file is corrupt, the next step is to find the most recent good .yw5 file in the Autobackups folder. The names of the folders under the Autobackups folder are dates. Start with the most recent. There should be a file in it named (your project name).yw5_Latest.zip. If there isn't, it means you didn't open the project on that day. If not, look for a file named Full Backup of (your project name).zip. If there isn't one of those, either, you'll need to work back through the dated directories until you come to either a yw5_Latest or a Full Backup. Once you find one, drill down through the directory structure in the zip until you reach the .yw5 file.

Extract it and you should have a good project file again. WARNING: Any changes you made other than scene contents after the time this backup was made will be lost. Contents of new scenes can be recovered by opening their RTF files and copying out the contents, but anything else is lost. This is why that .bak file is so important, because it normally is up to date as of the last time you closed the project.

If it's still corrupted

IF AFTER YOU REPAIR YOUR PROJECT YOU OPEN IT AND FIND IT'S STILL CORRUPTED, either your backup was already corrupted or there's a problem causing it to corrupt when opened. The only known instance of the latter occurs when you open a yWriter project saved with beta 5.1.2.2 in a later version. There are instructions in the discussion archives for correcting that. If your problem is that your last backup was bad, try the one before it. It should always be possible to recover, with the understanding that work done since the last good backup may not be retrievable.