|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
How to know if a file is ready.My program is monitoring the files on a folder. Some of them take a while to
be transferred and some are simply locked by the user. How do I know when a file is "done" transferring or released by the user? Just check for IO errors. If there are any then the files are most probably
in use Crouchie1998 BA (HONS) MCP MCSE You mean something like this?
Private Function FileBeingUsed(ByVal sFile As String) As Boolean Dim fInfo As New IO.FileInfo(sFile) If fInfo.Attributes = IO.FileAttributes.ReadOnly Then 'if the file is read only then by definition isn't it ready? Return False End If Dim fNum As Integer = FreeFile() Try FileOpen(fNum, sFile, OpenMode.Output, OpenAccess.Write, OpenShare.Shared) FileClose(fNum) Return False Catch ex As Exception Return True End Try End Function Isn't this a little "brute force"? Do you have a better method/suggestion? Show quoteHide quote "Del" <crouchie1998@spamcop.net> wrote in message news:OXrAtNRIGHA.3936@TK2MSFTNGP10.phx.gbl... > Just check for IO errors. If there are any then the files are most > probably in use > > Crouchie1998 > BA (HONS) MCP MCSE >
UGH, Framework goes just so far AGAIN!
forms collection? VS2005 - How do you... Help with truncating GUI Design Question URGENT: Problem when iterating through a custom collection (dictionary based) with FOR...EACH WEBREQUEST AND WEBRESPONSE PROBLEM Problem when iterating through custom dictionary based collection with FOR...EACH...NEXT Process output redirection? Using a VB.net dll in VB6 |
|||||||||||||||||||||||