Click here to Skip to main content
15,888,351 members
Home / Discussions / C#
   

C#

 
QuestionFileSystemWatcher how to wait for file copy completion? Pin
Chesnokov Yuriy7-Feb-11 4:02
professionalChesnokov Yuriy7-Feb-11 4:02 
AnswerRe: FileSystemWatcher how to wait for file copy completion? Pin
Thomas Krojer7-Feb-11 4:09
Thomas Krojer7-Feb-11 4:09 
AnswerRe: FileSystemWatcher how to wait for file copy completion? Pin
Chesnokov Yuriy7-Feb-11 7:18
professionalChesnokov Yuriy7-Feb-11 7:18 
AnswerRe: FileSystemWatcher how to wait for file copy completion? Pin
#realJSOP7-Feb-11 4:24
mve#realJSOP7-Feb-11 4:24 
AnswerRe: FileSystemWatcher how to wait for file copy completion? Pin
Ennis Ray Lynch, Jr.7-Feb-11 4:26
Ennis Ray Lynch, Jr.7-Feb-11 4:26 
AnswerRe: FileSystemWatcher how to wait for file copy completion? Pin
Luc Pattyn7-Feb-11 4:30
sitebuilderLuc Pattyn7-Feb-11 4:30 
AnswerRe: FileSystemWatcher how to wait for file copy completion? Pin
Pete O'Hanlon7-Feb-11 5:17
mvePete O'Hanlon7-Feb-11 5:17 
AnswerRe: FileSystemWatcher how to wait for file copy completion? Pin
Dave Kreskowiak7-Feb-11 6:28
mveDave Kreskowiak7-Feb-11 6:28 
Just to be clear, there is no "completion event". The FSW tells you when a file is CREATED, not when a copy operation is going on.

A file copy operation is just an application (Explorer) opening one file for read and another file for write. Read the bytes from one file and write them to another.

The FSW cannot tell what is going on with the files.

But, yeah, your code has to respond to the Created event from the FSW, then start trying to open the file for read with exclusive access (ShareDenyAll). If the open statement fails, wait for a few seconds, then try it again. When you finally get the file open, your copy operation should be done. Close the file and process to do whatever you wanted with the file.

QuestionProblem by using an Object and a variable inside another function [modified] Pin
nstk7-Feb-11 2:59
nstk7-Feb-11 2:59 
GeneralRe: Problem by using an Object and a variable inside another function Pin
musefan7-Feb-11 3:15
musefan7-Feb-11 3:15 
GeneralRe: Problem by using an Object and a variable inside another function Pin
nstk7-Feb-11 7:19
nstk7-Feb-11 7:19 
Questiondynamic way to analyse settings Pin
arkiboys7-Feb-11 2:55
arkiboys7-Feb-11 2:55 
AnswerRe: dynamic way to analyse settings Pin
musefan7-Feb-11 3:08
musefan7-Feb-11 3:08 
AnswerRe: dynamic way to analyse settings Pin
#realJSOP7-Feb-11 3:42
mve#realJSOP7-Feb-11 3:42 
Questionmessenger Pin
om_metab7-Feb-11 1:19
om_metab7-Feb-11 1:19 
AnswerRe: messenger Pin
OriginalGriff7-Feb-11 1:28
mveOriginalGriff7-Feb-11 1:28 
GeneralRe: messenger Pin
om_metab7-Feb-11 1:43
om_metab7-Feb-11 1:43 
AnswerRe: messenger Pin
Keith Barrow7-Feb-11 1:42
professionalKeith Barrow7-Feb-11 1:42 
GeneralRe: messenger Pin
Abhinav S7-Feb-11 2:27
Abhinav S7-Feb-11 2:27 
GeneralRe: messenger Pin
Keith Barrow7-Feb-11 4:26
professionalKeith Barrow7-Feb-11 4:26 
GeneralRe: messenger Pin
Bernhard Hiller8-Feb-11 3:07
Bernhard Hiller8-Feb-11 3:07 
GeneralRe: messenger Pin
Keith Barrow8-Feb-11 9:41
professionalKeith Barrow8-Feb-11 9:41 
AnswerRe: messenger Pin
PIEBALDconsult7-Feb-11 1:45
mvePIEBALDconsult7-Feb-11 1:45 
GeneralRe: messenger Pin
om_metab7-Feb-11 2:18
om_metab7-Feb-11 2:18 
GeneralRe: messenger PinPopular
Pete O'Hanlon7-Feb-11 2:37
mvePete O'Hanlon7-Feb-11 2:37 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.