Results 1 to 4 of 4

Thread: FileCopy Error

  1. #1

    Thread Starter
    New Member
    Join Date
    Jul 2003
    Posts
    2

    FileCopy Error

    Hi,
    Iam trying to copy an executable from Folder A to Folder B.
    1. If a back up executable is found in Folder B then delete it. (Example: delete exe1bkp.exe)
    2. If an executable without bkp is found then rename it. (Example: "exe1" & "bkp" & ".exe"
    3. Copy the new updated executable "exe1.exe" from Folder A to Folder B.
    I am using the following code.
    VB Code:
    1. Private Sub CopyFolder()
    2. Dim i As Integer, j As Integer, strFile As String, FileName As String, fs
    3. Dim SourceFile, DestinationFile, srcFname, dstFname, fileContent, SearchContent
    4. List3.Clear
    5. Set fs = CreateObject("Scripting.FileSystemObject")
    6. strFile = Dir("C:\TempCafesoftUpdateFolder\exes\*.exe")
    7. While Not Len(strFile) = 0
    8.     List3.AddItem strFile
    9.     For i = 0 To List3.ListCount - 1
    10.         If strFile = List3.List(i) Then
    11.             For j = 0 To List3.ListCount - 1
    12.                 'Delete the file
    13.                 FileName = App.Path & "\bkp" & strFile
    14.                 If (fs.FileExists(FileName)) Then fs.DeleteFile (FileName)
    15.             Next
    16.             DoEvents: DoEvents: DoEvents: DoEvents: DoEvents: DoEvents: DoEvents
    17.             Name App.Path & "\" & strFile As App.Path & "\bkp" & strFile
    18.             srcFname = "C:\TempCafesoftUpdateFolder\exes\" & strFile
    19.             dstFname = App.Path & "\" & strFile
    20.             DoEvents: DoEvents: DoEvents: DoEvents: DoEvents: DoEvents: DoEvents
    21.             Label4.Visible = True
    22.             Label4 = "Copying " & strFile & " to " & App.Path & "\exes"
    23.             DoEvents: DoEvents: DoEvents: DoEvents: DoEvents: DoEvents: DoEvents
    24.             FileCopy srcFname, dstFname
    25.             Label4.Visible = False
    26.         End If
    27.     Next
    28.     strFile = Dir()
    29. Wend
    30. End sub
    When FileCopy runs, the program generates an error. What is wrong with this code? Pl help.
    Thanks in advance
    IFKI

  2. #2
    PowerPoster
    Join Date
    Aug 2001
    Location
    new jersey
    Posts
    2,904
    FileCopy runs, the program generates an error
    I take it we're supposed to guess what the error is, yes?

  3. #3

    Thread Starter
    New Member
    Join Date
    Jul 2003
    Posts
    2

    FileCopy Error

    The error is "Error # 61 generated by exename"
    "Disk Full"
    IFKI

  4. #4
    Former Admin/Moderator MartinLiss's Avatar
    Join Date
    Sep 1999
    Location
    San Jose, CA
    Posts
    33,431
    I edited your post and added VBCode tags to make it easier to read.

    Could your Disk actually be full?

    What are you trying to accomplish with

    DoEvents: DoEvents: DoEvents: DoEvents: DoEvents: DoEvents: DoEvents

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