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?
Printable View
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?
Try this:
Or 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
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
I'll try both and see how much i can screw up code that probably works fine
Actually, I think it already displays a progressbar for larger file transfers.
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