Noneic24 wrote:I have been asked by a friend to try and recover the contents of a Writer file that were deleted and the file was then saved.
The "save a backup copy" is not switched on by default. The folder is specified in Tools > Options > OpenOffice > Paths.
1 Stop them using the computer NOW - the more they use it, the more likely something you want will be overwritten. But don't switch it off or let it hibernate - when it hibernates, or re-boots, it writes its paging file which is large and over-writes a large area of disk.
Edit: This only works if you were editing a .odt file - it does not work if you were editing a .doc file. |
Edit: See Using Recuva to un-delete Writer temporary files for help recovering the temporary files which Writer wrote while you were editing the document, and then deleted when Writer was closed.
The post has been extensively updated [June 2016] to show how AutoRecovery files can be un-deleted for .odt files; for files which have never been saved; and for .doc files. |
2 If the file was open, and data was added, and that data was deleted, and the file was then saved, you may be able recover the deleted data as below, especially if they had AutoSave set such that Writer AutoSaved every few minutes..
Writer uses temporary files to hold data, and you might be able to recover these temporary files which will now have been deleted by Writer when Writer (AOO?) closes) so they will not be in the Recycle bin. But, if you are lucky you might get them back with Recuva.
1 Tools > Options > OpenOffice > Paths > Look for where the temporary files are stored - in Windows 7 mine are located in C:\Users\John\AppData\Local\Temp\. The user may have Windows set up such that these are hidden files - if so, switch on "Show hidden files" by opening any folder in Windows > Tools > Folder options > View > Show hidden files (and possibly un tick Hide protected system files). Also, un-tick Hide extensions for known file types. Remember to undo this afterwards if you want to ...
2 The following is a based on opening a .ODT file and watching what happens.
When Writer starts, it creates a folder in ...\Temp called something like C:\Users\John\AppData\Local\Temp\svbhjgpu.tmp. Note that svbhjgpu.tmp looks like a file because it is named svbhjgpu.tmp but it is NOT a file - it is a FOLDER.
Inside that folder Writer creates a number of files svbhjXXX.tmp where the first (up to 5) characters are the same as the the first (up to 5) characters of the folder name, and XXX are random characters. Hence these files are C:\Users\John\AppData\Local\Temp\svbhjgpu.tmp\svbhjXXX.tmp. The first the .odt file you are editing, as it was when last saved - this is the file you want as it contains the text and images. The other files are the images in the document, stored as GRF format, or as JPG or PNG format. You want to un-delete all these files, find which is the .odt file, and rename it Fred.odt.
There will probably be several folders, one for each time Writer opened this or another document. Look for the most recent ones and work backwards to the older ones.

- ...\Temp\svbhjgpu.tmp folder containing 2 files - you need to recover these two files.
3 When Writer (AOO?) closes, it (usually, but not always) deletes all these temporary folders and files. It is worth just checking to see if any are still there.
If none are there, your challenge - successful in many cases - is to find the deleted tmp files with a utility like Recuva.
When you do find them, try to unzip them. With luck, one will unzip - it is the .odt file for which you are looking. Rename it Fred.odt and open it with Writer.
If it will not open, all is not lost. Unzip it and look for a file called content.XML. content.XML is a flat ASCII file, so open it with Notepad and look for your text. Notepad opens it, but the XML is just a single line with no line breaks (it can have 100,000+ characters in the single line) so it is a bit (read a lot!) more difficult to see the data.
It is easier to open it with a editor capable of "pretty printing" XML (eg Notepad++ with the XML Editor add-on > Plug-ins > XML Tools > Pretty print with line breaks).
If
the ODT file has been saved previously, when Writer opens it, Writer creates a copy of it in \Temp.
If
a new document is created, then the files in \Temp are empty (0 bytes) until the document is saved. When Writer Autosaves a document which has not been saved with File > Save As ... , and therefore does not have a proper name, Writer AutoSaves it into the backup folder (See Paths - mine is C:\Users\John\AppData\Roaming\OpenOffice\4\user\backup\) as ...\Backup\untitled_0.odt.
One strange thing - this is based on when the user saves in odt format. When I opened a .doc file, I could not see any temporary files in ...\Temp.
Edit: It seems that, while Writer creates a temporary file for the document when you are editing a .doc file, the file is zero bytes long and Writer does not store any data in it. Writer does store the images from the document as temporary files. You cannot therefore use this method to un-delete the text contents of a .doc file |
This is a picture of some temporary files in ...\Temp\sv166h3z.tmp folder while Writer has a document open. When Writer (AOO?) closes, these tmp files should get deleted.

- Several sv166XXX.tmp files stored in the sv166h3z.tmp folder - they are therefore ...\Temp\sv166h3z.tmp\sv166XXX.tmp, where XXX are random characters
Edit: EDITED to correct errors and add information. |
If you want to try this before you get problems, then open a .odt file and leave Writer open. Now go to .../Temp and look for a folder named something like abcdefg.tmp. Look inside that folder and you should see at least one .tmp file which has the same first two (or more) characters as the folder name. Writer owns these files so you cannot even look inside them, but there is a trick - take a copy of the file. Do this by right-click the file > Copy. right-click in the white area of the window > paste. This pastes a copy of the file in the same folder and you can open these files with your Zip utility or Notepad or Notepad++.[/strike]