• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1159
  • Last Modified:

Windows renaming files with extension tmp1 when dragging them to network share from desktop

Hi all,

I am currently using a FileSystemWatcher object in .NET to monitor a network share for newly created files. I was testing my application and it was working fine when I was creating new files in the network share (I was dragging and dropping from my desktop). However when I tested for a slightly larger file (approx 165KB) I noticed that when I dragged the file over, windows renamed the test.xml file to test.xml.tmp1 for a few seconds and then the file is renamed back to its original name.

The problem for me here is that the file.created event does not fire now in the FileSystemWatcher object. I may have to go down the route of monitoring for the renamed event but was wondering does anybody know why this is happening and any better solutions to the one I propose.

System: Win XP (64 bit), .NET 4.0, c#

Many thanks

b
0
basil365
Asked:
basil365
1 Solution
 
strickddCommented:
During a file copy from windows to a network share, the file may take a while to move (as you've seen). If you chose to cancel or a crash occurs, only part of the file would exist on the share which might indicate that the transfer was successful even though the file is corrupt.

To prevent this, Windows has added the temporary extension to transfer the file until it is complete and then performs the rename. A faster network would fix this or using the rename event watcher as you mentioned.
0

Featured Post

Get free NFR key for Veeam Availability Suite 9.5

Veeam is happy to provide a free NFR license (1 year, 2 sockets) to all certified IT Pros. The license allows for the non-production use of Veeam Availability Suite v9.5 in your home lab, without any feature limitations. It works for both VMware and Hyper-V environments

Tackle projects and never again get stuck behind a technical roadblock.
Join Now