Results 1 to 5 of 5

Thread: copying from one drive to another

  1. #1

    Thread Starter
    Hyperactive Member PJB's Avatar
    Join Date
    Aug 2000
    Location
    dunno at the moment
    Posts
    302
    So i have 2 drivelistboxes and a couple of dirlistboxes, how can i select a drive in the first drive list box and have it copy the entire contents over to the selected file in the dirlistbox for the 2nd drivelistbox?
    VB6.0 SP4
    Windows 2000
    I'm thinking of a number between

  2. #2
    Guest
    Try this:

    Code:
    Dim FSO as FileSystemObject
    'Else
    'Dim FSO as object
    
    Private Sub Form_Load()
    
    Set FSO = New FileSystemObject
    'or if latebound
    'Set FSO = CreateObject("scripting.FileSystemObject")
    
    'Syntax is object.MoveFolder source, destination
    
    FSO.MoveFolder "c:\myFolder\","d:\backup\myfolder\"
    
    End Sub
    Or this:

    Code:
    Public Type SHFILEOPSTRUCT
       hWnd        As Long
       wFunc       As Long
       pFrom       As String
       pTo         As String
       fFlags      As Integer
       fAborted    As Boolean
       hNameMaps   As Long
       sProgress   As String
     End Type
      
    Public Const FO_MOVE = &H1
    Public Const FO_COPY = &H2
    Public Const FO_DELETE = &H3
    Public Const FO_RENAME = &H4
    
    Public Const FOF_SILENT = &H4
    Public Const FOF_RENAMEONCOLLISION = &H8
    Public Const FOF_NOCONFIRMATION = &H10
    Public Const FOF_SIMPLEPROGRESS = & H100 
    Public Const FOF_ALLOWUNDO = &H40
    
    
    Public Declare Function SHFileOperation _
        Lib "shell32.dll" Alias "SHFileOperationA" _
        (lpFileOp As SHFILEOPSTRUCT) As Long
    
    
    Private Sub Command1_Click()
    Dim SHF As SHFILEOPSTRUCT
    Dim lret As Long
    
    SHF.wFunc = FO_COPY
    SHF.hWnd = Me.hWnd
    SHF.pFrom = "c:\*.*"
    SHF.pTo = "D:\backup\c\"
    SHF.fFlags = FOF_SILENT
    
    lret = SHFileOperation(SHF)
    
    'Returns 0 if successful
    
    If lret <> 0 Then
        MsgBox "Error"
    End If
    
    
    End Sub

  3. #3

    Thread Starter
    Hyperactive Member PJB's Avatar
    Join Date
    Aug 2000
    Location
    dunno at the moment
    Posts
    302
    I'll try both and see how much i can screw up code that probably works fine
    VB6.0 SP4
    Windows 2000
    I'm thinking of a number between

  4. #4
    Guest
    Actually, I think it already displays a progressbar for larger file transfers.

  5. #5

    Thread Starter
    Hyperactive Member PJB's Avatar
    Join Date
    Aug 2000
    Location
    dunno at the moment
    Posts
    302
    yes it does in a seperate window,my boss wanted it on the main form, i told him to put it there so we are going with the default one that pops up
    VB6.0 SP4
    Windows 2000
    I'm thinking of a number between

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