| | |
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 2008 access add advanced application array assignment basic beginner box browser button buttons center click client code combo convert cpu cuesent data database datagrid datagridview datetimepicker designer dissertation dissertations dissertationtopic eclipse editvb.net employees excel exists filter forms function html images isnumericfuntioncall listview map mobile module msaccess mssqlbackend mysql net number open page pan panel pdf picturebox picturebox2 port position print printing printpreview read record regex reuse right-to-left save search serial settings socket sorting sqldatbase sqlserver storedprocedure temp textbox timer timespan transparency txttoxmlconverter usercontol vb vb.net vba vbnet vista visual visualbasic visualbasic.net visualstudio.net web winsock wpf wrapingcode xml year





