Results 1 to 3 of 3

Thread: filecopy method

  1. #1

    Thread Starter
    Hyperactive Member ravi15481's Avatar
    Join Date
    Aug 2002
    Location
    INDIA
    Posts
    421

    filecopy method

    hi friends.
    how to know whether a file copied using filecopy method is copied completely or not.

    actually where i got the problem is i am copying a file to a temp dir and from then i am doing some operations with the copied file but as the file is not copied full i am not able to get what i want.
    please help me out..

    thanx
    A good friend...

  2. #2
    Member
    Join Date
    Aug 2002
    Posts
    33

    File copy test

    You check to see if a file has been fully copied by trying to rename it. If the rename fails then the file has not fully been copied.
    Try using the function below. Returns true if all ok.

    Function FileRenameCheck(fileDir As String, fileNameToCheck As String) As Boolean
    On Local Error GoTo errh

    1000 Dim OldName As String
    1001 Dim TempName As String
    1002 Dim V1 As Long
    1003 Dim V2 As Integer

    1010 OldName = fileDir & fileNameToCheck
    1020 V1 = Int((999999 * Rnd) + 1)
    1030 V2 = Int((99 * Rnd) + 1)
    1040 TempName = fileDir & "!" & V1 & "!." & V2 & "!"
    1050 FileRenameCheck = False
    1060 Name OldName As TempName
    1070 Name TempName As OldName
    1080 FileRenameCheck = True

    1100 errh:
    End Function

  3. #3

    Thread Starter
    Hyperactive Member ravi15481's Avatar
    Join Date
    Aug 2002
    Location
    INDIA
    Posts
    421
    thanx cadmando(sorry i dont know ur real name) it worked very well...
    A good friend...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width