| | |
Moving a file before its modifed
Please support our VB.NET advertiser: Intel Parallel Studio Home
![]() |
.NET has a FileSystemWatcher control which monitors changes in a given directory and notifies if there are changes made. See MSDN documentation of FileSystemWatcher Class.
Teme64 @ Windows Developer Blog
•
•
Join Date: Apr 2009
Posts: 6
Reputation:
Solved Threads: 0
thanks for that it has def pointed me in the right direction i have got it to copy the file once it has been updated but it trys to do it twice here is my code
Dim FileGoto As String
FileGoto = "c:\watch\"
If e.ChangeType = IO.WatcherChangeTypes.Changed Then
System.IO.File.Copy(e.FullPath, FileGoto & e.Name)
End If
i think i am just missing somthing stupid :-P
Dim FileGoto As String
FileGoto = "c:\watch\"
If e.ChangeType = IO.WatcherChangeTypes.Changed Then
System.IO.File.Copy(e.FullPath, FileGoto & e.Name)
End If
i think i am just missing somthing stupid :-P
•
•
Join Date: Dec 2008
Posts: 18
Reputation:
Solved Threads: 0
Off the top of my head, with no testing done, I think it tries to do it more than once because there are different types of changes occuring in the file being watched... e.g Changes to its attributes, to its size, to the LastWriteTime and so on. When a file is written to, the size changes as well as the LastWriteTime and each of these changes causes the program to try to copy the file.
You're right that there actually happens two changes. File changes and the folder's attributes do change too. That causes a small problem.
willrose84 started a new thread "FileSystemWatcher Duplicting the same event" about that issue and I gave him/her a workaround solution.
willrose84 started a new thread "FileSystemWatcher Duplicting the same event" about that issue and I gave him/her a workaround solution.
Teme64 @ Windows Developer Blog
![]() |
Other Threads in the VB.NET Forum
- Previous Thread: Array
- Next Thread: Open form with new record
| Thread Tools | Search this Thread |
.net .net2008 2005 2008 access account arithmetic array arrays basic bing button buttons c# center check checkbox code convert crystalreport data database datagrid datagridview date dissertation dissertations dropdownlist excel fade file-dialog filter ftp generatetags google gridview hardcopy images inline input insert intel internet listview mobile monitor ms net networking objects output panel passingparameters picturebox picturebox1 port position print printing problem project read remove save searchbox searchvb.net select serial server shutdown soap sorting survey table tcp temperature text textbox timer timespan toolbox trim update user validation vb vb.net vb.netformclosing()eventpictureboxmessagebox vb2008 vbnet view visual visualbasic visualbasic.net visualstudio visualstudio2008 web winforms wpf year





