Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
FileInfo.MoveTo delay
Message
From
29/11/2012 04:03:15
 
 
To
28/11/2012 09:06:22
General information
Forum:
ASP.NET
Category:
Coding, syntax and commands
Environment versions
Environment:
VB 9.0
OS:
Windows 7
Network:
Windows 2003 Server
Database:
MS SQL Server
Application:
Web
Miscellaneous
Thread ID:
01558133
Message ID:
01558305
Views:
56
>>My understanding is that when Windows moves a file to another folder on the same partition it simply modifies the path so the size of file should not be a factor.
>
>Ok
>
>>If you are using DirectoryInfo() then you could try calling it's Refresh() method before checking for the existence of the moved file.
>
>The DirectoryInfo() object is created after the MoveTo(). Are you suggesting that it might be possible that by the time I use that command that it cannot see the file yet because it has been called too fast after the MoveTo()?

No (although you may be right if MoveTo() is async), if DirectoryInfo() is instantiated after the MoveTo() then presumably the Refresh() would not help.

>>But it is still not clear to me what triggers the call to MoveTo() - as before, if this is an event (such as using Filewatcher) then you could have re-entrant code.
>
>I am not sure what the question is. This is simply VB.NET code.

But events are still events :-}
If the method containing the MoveTo() is triggered by an event then it's possible that a new call will tread on an existing one with obvious consequences. If that's a possibility then putting a lock on the method might be a solution.....
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform