EldoS | Feel safer!

Software components for data protection, secure storage and transfer


Posted: 07/22/2009 08:35:38
by Tim Hayes (Standard support level)
Joined: 06/06/2007
Posts: 36

I am looking into the niceties of MS Office document creation / editing and trying to deal with temporary file creation.

In the attached log, a temporary file "\New Microsoft Office PowerPoint Presentation.pptx~RF8ac238.TMP" is created then closed. Shortly afterward, a file called "\New Microsoft Office PowerPoint Presentation.pptx" is renamed to "\New Microsoft Office PowerPoint Presentation.pptx~RF8ac238.TMP" thus effectively creating a duplicate file name.

Should I (a) accept the situation and allow a duplicate to be created - seems wrong - or (b) raise an error? I had thought that Windows would block trying to create a file with duplicate name in the folder.

Thanks in advance.

Tim Hayes

[ Download ]
Posted: 07/22/2009 08:46:46
by Eugene Mayevski (Team)

You need to check the flags and attributes of the file being created. If the "original" ...TMP file is created with Temporary attribute, then you must delete it once it's closed. In this case there's no duplicate file.

Sincerely yours
Eugene Mayevski
Posted: 07/22/2009 09:47:17
by Tim Hayes (Standard support level)
Joined: 06/06/2007
Posts: 36

Thanks for assisting me Eugene - another few lines of code to add to the project!!
Posted: 09/01/2009 17:36:26
by Gavin McKay (Standard support level)
Joined: 09/01/2009
Posts: 48

I had this same issue with Office and temporary files. I used FileMon from SysInternals (now Microsoft) to track down what was happening.

When creating a new Word/Excel document and saving, the following occurs (assuming doc1.docx is my file and z: is my virtual drive):

1. Create a zero-byte z:\doc1.docx
3. Delete z:\doc1.docx
4. Create a temporary file ~WRD0000.tmp (or similar)
5. Write to the temporary file ~WRD0000.tmp
6. Rename ~WRD0000.tmp to doc1.docx
7. Create a second temporary file ~$doc1.docx (or similar)
8. Write to ~$doc1.docx

So in effect there are three files created in the process of saving a new document.



Topic viewed 2852 times

Number of guests: 1, registered members: 0, in total hidden: 0


Back to top

As of July 15, 2016 EldoS business operates as a division of /n software, inc. For more information, please read the announcement.

Got it!