[Tutorial] How to find and un-delete Writer temporary files

Forum rules
No question in this forum please
For any question related to a topic, create a new thread in the relevant section.

[Tutorial] How to find and un-delete Writer temporary files

Postby John_Ha » Fri Sep 09, 2016 12:13 pm

 Edit: This tutorial is often updated to add information and make clarifications 


 Edit: Although this is written based on Writer .odt files, it also works for Calc .ods files and presumably all AOO files. 

If you have lost a file, or have a file which is full of ######, and want to un-delete the temporary files then STOP USING THE PC and DO NOT POWER IT OFF until you have recovered the file so as to maximise your chance of success.

The post looks complex but it is actually pretty simple - just work slowly through it. If you get stuck ask someone with better computer skills to help you, or print the instructions (File > Print ...) and take the instructions and your PC to a PC repair shop.

First look for previous versions of the file itself

Say you have lost ...\My documents\fred.odt (or fred.doc or fred.rtf etc). Before trying to get back temporary files, use Recuva to see if you can get back previous versions of ...\My documents\fred.odt (or fred.doc or fred.rtf) by looking for deleted fred.odt (or deleted fred.doc or fred.rtf etc) in ...\My Documents (or in whichever folder the file was located).

Did you have AutoRecovery set to ON?

Check if AutoRecovery was set to ON by Tools > Options > Load/Save > General ...

If so, and you were editing fred.odt, look in C:\Users\xxxxxx\AppData\Roaming\OpenOffice\4\user\backup for fred.odt_0.odt. This is the file as it was when it was last saved by AutoRecovery. You could also look for deleted versions.

Did you have Create a Backup copy set to ON?

Check if Create a Backup copy was set to ON by Tools > Options > Load/Save > General ...

If so, and you were editing fred.odt, look in C:\Users\xxxxxx\AppData\Roaming\OpenOffice\4\user\backup for fred.bak. Open fred.bak with Writer (or rename it to fred.odt). This is the file as it was when you opened it for editing. You could also look for deleted versions.

No luck so far? It's time to look for temporary files.

Looking for temporary files

When you edit a file, Writer creates temporary files. Writer deletes these temporary files when you close the document and/or when Writer closes properly.

When you open an existing .odt file, Writer takes a copy of the file as it was when opened and saves it as a temporary file. This is the file you are trying to recover.

If you save a .odt file while you are editing it and continue to edit it, Writer updates the temporary file above to be the same as the newly saved file.

If you create a new document from scratch Writer creates an empty temporary file with nothing in it.

Temporary files created when a .odt file is being edited.png
Temporary files inside folder C:\Users\John\AppData\Local\Temp\sv3i2d1f.tmp

The first file is the .odt file as it was when you opened it - this is the one you want
The second file is a binary file - ignore it - it is to do with displaying
The other files are copies of the images which have been paged out of memory. You do not need them as all the images are in the first file. If you have added images then some may be here

The following is based on Windows 7 but other versions of Windows should be very similar.

Mac and Linux

If you are running Mac or Linux, it should still be very similar. All you need to do is to check which paths Writer uses by Tools > Options (Preferences for Mac??) > OpenOffice > Paths .... If you are in doubt, open a .odt file (or create a new one or edit a .doc file - whatever it was you were doing when you lost the document) and check to see where the temporary files go and what they are called. Then search in that folder or folders for deleted temporary files for your lost document where the deleted files will have similarly formed names to those you found when doing the check. You will a need Mac or Linux unzip utility and a Mac or Linux un-delete utility.

Note for those with Solid State Disks (SSD)

If you are using a Solid State Disk, the Operating System will silently work in the background to delete all the data from deleted files and reset all the file bits to zero so you may not find that many temporary files. The OS does this because the OS must set all bits to zero before writing to an SSD. Setting the bits to zero in the background therefore speeds future writes.


USB memory stick or second disk

It is better (but not essential) to un-delete the file(s) to a different disk from the disk on which the original file was created or saved because, if you un-delete to the same disk, you run the risk overwriting the very files you are trying to get back! It is better to recover them to a USB memory stick, or to a second disk if you have one.

The required files are hidden files ...

... so before you begin you must switch on being able to see hidden files by:

1 Start > Control Panel > Folder Options > View ...

2 tick Show Hidden files, folders and drives

If you have not done this you will not be able to see the temporary files folder or the temporary files inside it.

Show hidden files MUST be enabled.png
You MUST switch on Show Hidden Files and Folders or you will not be able to see the temporary folder or the files inside it


1. Looking for temporary files which are still there and have not been deleted

1a. If your PC or Writer crashed ...

... you may find that the temporary files are still there, so navigate to the Temp folder (it is specified in Tools > Options > OpenOffice > Paths ...) and see if you can see them. Sort the files in alphabetical order and rename the first xxxxxxxx.tmp to xxxxxxxx.odt and try to open it.

If you cannot see any, then Writer has deleted them. You now need to un-delete them. Act quickly - they risk being overwritten the longer you leave it..

1b. Did you have AutoRecovery set to ON?

If you had AutoRecovery set to ON, then Writer should have automatically fixed your file for you. If Writer does not or cannot recover your file, follow the instructions below and check to see if the AutoRecovery files are still there. If there are no AutoRecovery files then look for deleted the AutoRecovery files. (Note - check to see if AutoRecovery was on by Tools > Options > Load/Save > General ...)

1c. Did you have Create a backup copy set to ON?

If you had Create a backup copy ... set to ON, look in the Backup folder for a file called fred.bak, where your file is fred.odt. Open fred.bak with Writer (or rename it to fred.odt). (Check to see Create a backup copy was ON by Tools > Options > Load/Save > General ...)

2. Looking for temporary files which have been deleted

If 1a, 1b and 1c failed you have to look for deleted temporary files. The method you use depends on what type of file you were editing, namely:

- whether it was an existing .odt file saved on your PC (or .docx file);
- a file which you had never previously saved; or
- a .doc file.

From what I can gather, Writer handles .docx files in the same way as .odt files so, if you are recovering a .docx file, follow the instructions for .odt files.

2a. Recovering .ODT files which have previously been saved - also works for .docx files

In this case, you were editing a .odt file like fred.odt (or fred.docx).

You are looking for files with names something like C:\Users\xxxxxx\AppData\Local\Temp\sv2ju1mk.tmp\sv2ju21c.tmp. Note that it is very unusual for a folder to be called C:\Users\xxxxxx\AppData\Local\Temp\sv2ju1mk.tmp\, with a " . " in the folder name, but this is what Writer does. You will therefore be looking for files called something like C:\Users\xxxxxx\AppData\Local\\Temp\sv2ju1mk.tmp\sv2ju21c.tmp where xxxxxx is your username.

If you manage to find and undelete a file like ...\sv2ju21c.tmp, unzip it and check if it is a .odt (or .docx) file (some files with names like sv2ju21c.tmp will be graphics files). If sv2ju21c.tmp is a .odt (.docx) file, rename it to sv2ju21c.odt (sv2ju21c.docx) and open it. You should get back the complete fred.odt (fred.docx) file as it was the previous time it was saved.

You also get back all the images, both those already in the document when you opened it and all the images added since. You do not get the text added since the file was last saved.

If you had AutoRecovery set to ON then also see 3. Getting back AutoRecovery files when AutoRecovery has been set to ON below as you may also be able to recover some of the AutoRecovery files as well or instead.

3. Getting back AutoRecovery files when AutoRecovery has been set to ON

The following methods only work if you had AutoRecovery set to ON.

Note: you set AutoRecovery to ON by Tools > Options > Load/Save > General ... The Backup folder location is specified in Tools > Options > OpenOffice > Paths ..., and the default is C:\Users\xxxxxx\AppData\Roaming\OpenOffice\4\user\backup\.

3a. Recovering the AutoRecovery file for an existing fred.ODT which was being edited - it should also work for .docx files

If you were editing fred.odt, then Writer creates an AutoRecovery file called fred.odt_0.odt in the Backup folder. The default backup folder is C:\Users\xxxxxx\AppData\Roaming\OpenOffice\4\user\backup so you are looking for files named C:\Users\xxxxxx\AppData\Roaming\OpenOffice\4\user\backup\fred.odt_0.odt where " 0 " is a zero.

First, navigate to the Backup folder and look for existing files like fred.odt_0.odt.

Second, if there are no fred.odt_0.odt files in the Backup folder, then use Recuva and try to find a deleted version of fred.odt_0.odt. If you do manage to find it, fred.odt_0.odt will have the entire contents of the document as saved at the AutoRecovery time it was created.

3b. Recovering the AutoRecovery file for a new document which has never been saved

If you are editing a new file and you have never saved it, Writer gives the file the name Untitled1.odt while you are editing it but does not save it. When Writer creates an AutoRecovery file, Writer creates a file called untitled_0.odt in the Backup folder as C:\Users\xxxxxx\AppData\Roaming\OpenOffice\4\user\backup\untitled_0.odt where " 0 " is a zero.

First, navigate to the Backup folder and look for untitled_0.odt.

Second, if it is not there, then use Recuva and try to find a deleted version of the file. If you do manage to find it, it will have the entire contents of the document as saved at the AutoRecovery time it was created.

3c. .doc files. Recovering the AutoRecovery file for an existing fred.DOC which was being edited

When you edit fred.doc, and you have AutoRecovery set to ON, Writer creates a temporary AutoRecovery file for it in the Backup folder called fred.doc_1.odt whenAutoRecovery saves. The file will be named C:\Users\xxxxxx\AppData\Roaming\OpenOffice\4\user\backup\fred.doc_1.odt. Writer deletes this AutoRecovery file when you save the .doc file and/or close Writer.

Temporary file created when you edit a .doc file.png
When you edit a .doc file AND you have AutoRecovery ON, Writer creates a copy of the file in the Backup folder

First, navigate to C:\Users\xxxxxx\AppData\Roaming\OpenOffice\4\user\backup\ and look for fred.doc_1.odt, where fred is the name of the file you were editing. If your PC or Writer crashed, you may be lucky and still find fred.doc_1.odt there.

Second, if you do not see it, then use Recuva and look for deleted versions of it.

There are some more detailed explanations in the following posts which may be useful:

Using RECUVA to un-delete Writer .odt temporary files which are now deleted
Another on RECUVA

While I use the free Recuva, which runs under Windows, you can use any file recovery program. The free PhotoRec works under Windows, Linux and Mac OS.

These may also be helpful.

Using 7-ZIP
Inside an odt file
Hints on how to prevent it happening

Some hints ...

Always set AutoRecovery to ON - this saves a copy of the file every few minutes while you are working on it - it protects you against things like power cuts, OS freezes etc. Do so by Tools > Options > Load/Save > General ...

Always ?? set Create A Backup copy to ON - this keeps the previously saved version of the file fred.odt as fred.bak in the Backup folder. Do so by: Tools > Options > Load/Save > General ... The Backup folder location is shown by Tools > Options > OpenOffice > Paths ... You may need to switch on Show hidden files (Control Panel > Folder Options > View ...) to be able to see the folder and its contents.

Why the ?? ? Because you should remember that highly_personal.bak will still be in the Backup folder long after you have deleted highly_personal.odt.

... and, of course, always take a daily backup of all important files and store them somewhere safe. A cheap USB memory stick is infinitely better than nothing. In an emergency, or if you need a very quick backup, just email yourself a copy of the file!

Remember, it is not a case of "if my disk fails ..." or "if I lose my file". It is a case of what do I do "when my disk fails ..." and "when I lose my file ...". You can download free backup utilities which will back up your hard drive daily so that you will never lose more than 24 hours work - I have used Cobian from http://www.cobiansoft.com/index.htm for many years and have never lost a file despite having disk crashes and lightning which destroyed both my PC and hard drive.

See the thread [Hint] How did I fix my ODT file for a discussion and some examples of broken, corrupted and lost files.
Last edited by John_Ha on Mon Jul 17, 2017 12:56 pm, edited 1 time in total.
AOO 4.1.3, Windows 7 Home 64 bit

See the OOo v3.3 Writer Manual, the Writer FAQ, the Writer Tutorials and the up to date Writer guide for information. Click the Help button on a pop-up window for extensive help on that function.
John_Ha
Volunteer
 
Posts: 4018
Joined: Fri Sep 18, 2009 5:51 pm
Location: UK

Re: [Tutorial] How to find and un-delete Writer temporary fi

Postby raum » Fri Jul 14, 2017 8:46 pm

Not sure if we werent meant to post replies here, BUT THANK YOU! this saved me days of work. Version of file was sitting there in the temp folder.
THANKS!
OpenOffice 3.1
raum
 
Posts: 1
Joined: Fri Jul 14, 2017 8:43 pm


Return to Writer

Who is online

Users browsing this forum: No registered users and 1 guest