Results 1 to 6 of 6

Thread: [Resolved] objFS copy Problems...

Threaded View

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Sep 2005
    Posts
    540

    [Resolved] objFS copy Problems...

    I'm using the following code:

    VB Code:
    1. Private Sub Copy_Folder(From_ As String, To_ As String)
    2.  
    3. If Len(Dir$(To_, vbDirectory)) > 0 Then
    4.        objFS.DeleteFolder To_
    5.        objFS.CreateFolder To_
    6.    Else
    7.        objFS.CreateFolder To_
    8. End If
    9.  
    10. objFS.CopyFolder From_, To_
    11.  
    12. End Sub

    I'm trying to copy all the contents off my K drive into D:\Backup.
    The program i'm trying to create automatically backs up my USB key apon being plugged in (that bit i'm still working on), for now i'm trying to just get it to copy the contents of the USB device!

    The error i get is:

    Run-time Error '5':
    Invalid procedure call or argument

    I have code that creates another folder inside the backup folder (with the date and time inside the name), but i don't think that that is causing the problem.
    VB Code:
    1. Private Sub Backup_Event()
    2. Dim Tmp_Dest As String
    3.  
    4. If ChkOverWrite.Value = 0 Then
    5.  
    6. Tmp_Dest = BackUpDirTxt.Text & "\BU (" & DriveLetter.Text & ") - " & Get_Date_Time
    7. Copy_Folder DriveLetter.Text & ":\", Tmp_Dest
    8.  
    9. Else
    10.  
    11. If ChkOverWrite.Value = 1 Then
    12.  
    13. Tmp_Dest = BackUpDirTxt.Text & "\BU (" & DriveLetter.Text & ")"
    14. Copy_Folder DriveLetter.Text & ":\", Tmp_Dest
    15.  
    16. End If
    17. End If
    18.  
    19. End Sub
    20.  
    21. Public Function Get_Date_Time()
    22. Dim sTime As SYSTEMTIME
    23. GetLocalTime sTime
    24.    
    25. Get_Date_Time = sTime.wYear & sTime.wMonth & sTime.wDay & sTime.wHour & sTime.wMinute & sTime.wSecond
    26.  
    27. End Function

    Please note that the overwrite checkbox isn't used for overwriting. It detmines whether a new folder should be made with the date & time, or if it just saves to the one folder each time.

    I have tried putting a True or False on the end of
    VB Code:
    1. objFS.CopyFolder From_, To_
    but it doesn't make a difference.

    Thank you!
    Last edited by Slyke; Jul 26th, 2006 at 09:40 AM.

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